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

pl/pgsql problem with search_path

From: Eugene Chow <gene(at)paragonam(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: pl/pgsql problem with search_path
Date: 2003-09-05 23:35:27
Message-ID: A117F7BA-DFF9-11D7-B756-000502871889@paragonam.com (view raw or flat)
Thread:
Lists: pgsql-bugs
My plpgsql function seems to be ignoring search_path when looking for 
the right table to select from. I'm running 7.3.4. Below is my test 
code. Am I doing something wrong?

TIA, Gene Chow

test=> create or replace function getval() returns varchar as '
test'> declare val varchar;
test'> begin
test'>     select into val value from bar limit 1;
test'>     return val;
test'> end;' language 'plpgsql';
CREATE FUNCTION

test=> create table public.bar ( value varchar );
CREATE TABLE

test=> insert into public.bar values ('public value');
INSERT 4012748 1

test=> create schema foo;
CREATE SCHEMA

test=> create table foo.bar ( value varchar );
CREATE TABLE

test=> insert into foo.bar values ('foo value');
INSERT 4012754 1

test=> set search_path to foo, public;
SET

test=> select *, getval() from bar;
    value   |  getval
-----------+-----------
  foo value | foo value
(1 row)

test=> set search_path to public;
SET

test=> select *, getval() from bar;
     value     |  getval
--------------+-----------
  public value | foo value
(1 row)


Responses

pgsql-bugs by date

Next:From: Dennis BjorklundDate: 2003-09-06 10:39:02
Subject: LOAD broken?
Previous:From: Tom LaneDate: 2003-09-05 21:17:33
Subject: Re: Unclear documentation (IMMUTABLE functions)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group