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

Lists: pgsql-bugs
From: "Karl Walbrecht" <kwalbrecht(at)cghtech(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5460: Search path not being used in function return type
Date: 2010-05-13 11:55:16
Message-ID: 201005131155.o4DBtGui033586@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 5460
Logged by: Karl Walbrecht
Email address: kwalbrecht(at)cghtech(dot)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


From: Erwin Brandstetter <brsaweda(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5460: Search path not being used in function return type
Date: 2010-05-13 13:19:38
Message-ID: 066f064e-80d6-41fe-8396-30e2e37add8e@i10g2000yqh.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On May 13, 1:55 pm, kwalbre(dot)(dot)(dot)(at)cghtech(dot)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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Karl Walbrecht" <kwalbrecht(at)cghtech(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5460: Search path not being used in function return type
Date: 2010-05-13 14:23:50
Message-ID: 29108.1273760630@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

"Karl Walbrecht" <kwalbrecht(at)cghtech(dot)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