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

Started by Karl Walbrechtalmost 16 years ago3 messagesbugs
Jump to latest
#1Karl Walbrecht
kwalbrecht@cghtech.com

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

#2Erwin Brandstetter
brsaweda@gmail.com
In reply to: Karl Walbrecht (#1)
Re: BUG #5460: Search path not being used in function return type

On May 13, 1:55 pm, kwalbre...@cghtech.com ("Karl Walbrecht") wrote:
(...)

-- 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

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/fa33f79733ede1f2

Regards
Erwin Brandstetter

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Karl Walbrecht (#1)
Re: BUG #5460: Search path not being used in function return type

"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