Обсуждение: BUG #5460: Search path not being used in function return type

Поиск
Список
Период
Сортировка

BUG #5460: Search path not being used in function return type

От
"Karl Walbrecht"
Дата:
The following bug has been logged online:

Bug reference:      5460
Logged by:          Karl Walbrecht
Email address:      kwalbrecht@cghtech.com
PostgreSQL version: 8.4.3
Operating system:   Solaris x86 64 bit
Description:        Search path not being used in function return type
Details:

# show search_path;
   search_path
------------------
 security, public

-- This works
CREATE OR REPLACE FUNCTION sec_authorization_check_all(
    v_entity_name varchar
) RETURNS setof security.entities AS

-- This does not
CREATE OR REPLACE FUNCTION sec_authorization_check_all(
    v_entity_name varchar
) RETURNS setof entities AS

psql:./functions/sec_authorization_check_all.sql:41: ERROR:  type "entities"
does not exist

Re: BUG #5460: Search path not being used in function return type

От
Erwin Brandstetter
Дата:
On May 13, 1:55=A0pm, kwalbre...@cghtech.com ("Karl Walbrecht") wrote:
(...)
> -- This does not
> CREATE OR REPLACE FUNCTION sec_authorization_check_all(
> =A0 =A0 v_entity_name varchar
> ) RETURNS setof entities AS
>
> psql:./functions/sec_authorization_check_all.sql:41: ERROR: =A0type "enti=
ties"
> does not exist


This issue may be related to the bug I reported earlier and has been
fixed by Takahiro Itagaki in the meantime:
http://groups.google.com/group/pgsql.bugs/browse_thread/thread/fa33f79733ed=
e1f2

Regards
Erwin Brandstetter

Re: BUG #5460: Search path not being used in function return type

От
Tom Lane
Дата:
"Karl Walbrecht" <kwalbrecht@cghtech.com> writes:
> Description:        Search path not being used in function return type

Works as expected for me ...

$ psql
psql (8.4.3)
Type "help" for help.

regression=# create schema security;
CREATE SCHEMA
regression=# create type security.entities as enum ('a','b');
CREATE TYPE
regression=# set search_path = security, public;
SET
regression=# CREATE OR REPLACE FUNCTION sec_authorization_check_all(
    v_entity_name varchar
) RETURNS setof security.entities AS $$
select 'a'::security.entities$$ language sql;
CREATE FUNCTION
regression=# CREATE OR REPLACE FUNCTION sec_authorization_check_all(
    v_entity_name varchar
) RETURNS setof entities AS $$
select 'a'::security.entities$$ language sql;
CREATE FUNCTION
regression=#

            regards, tom lane