Polymorphic functions' weird behavior
| От | Viatcheslav Kalinin |
|---|---|
| Тема | Polymorphic functions' weird behavior |
| Дата | |
| Msg-id | 46AF1EE1.10903@ipcb.net обсуждение исходный текст |
| Ответы |
Re: Polymorphic functions' weird behavior
|
| Список | pgsql-general |
Hello
We've come across the following issue with Polymorphic functions:
CREATE OR REPLACE FUNCTION "array_to_set" (vaarray anyarray) RETURNS
SETOF anyelement AS
$body$
BEGIN
FOR I IN COALESCE(ARRAY_LOWER(VAARRAY, 1), 1) ..
COALESCE(ARRAY_UPPER(VAARRAY, 1), 0) LOOP
RETURN NEXT VAARRAY[I];
END LOOP;
END
$body$
LANGUAGE 'plpgsql' SECURITY INVOKER;
> select * from array_to_set(array[1,2,3]);
array_to_set
--------------
1
2
3
(3 rows)
Now we change SECURITY INVOKER clause to SECURITY DEFINER and voila:
> select * from array_to_set(array[1,2,3]);
ERROR: could not determine actual argument type for polymorphic
function "array_to_set"
Though explainable this is absolutely strange since logically security
rules and polymorphism are irrelevant.
regards, Viatcheslav
В списке pgsql-general по дате отправления: