Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Polymorphic functions' weird behavior



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






Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group