Search Postgresql Archives

Polymorphic functions' weird behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
      choose an index scan if your joining column's datatypes do not
      match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux