Re: [BUGS] pl/pgsql problem with search_path

2003-09-07 Thread Eugene Chow
Thanks. If I had only read the manual before posting. I solved it by using 'execute' instead of 'select into' since the search_path is not static in my system. Gene On Saturday, September 6, 2003, at 04:21 PM, Bruce Momjian wrote: I think the problem is that the first time the function is c

Re: [BUGS] pl/pgsql problem with search_path

2003-09-07 Thread Bruce Momjian
Gaetano Mendola wrote: > "Bruce Momjian" <[EMAIL PROTECTED]> wrote: > > Tom Lane wrote: > > > Bruce Momjian <[EMAIL PROTECTED]> writes: > > > > This highlights another problem with our plpgsql function caching. > > > > > > It's a little disturbing to think that any change in SEARCH_PATH might > > >

Re: [BUGS] pl/pgsql problem with search_path

2003-09-07 Thread Gaetano Mendola
"Bruce Momjian" <[EMAIL PROTECTED]> wrote: > Tom Lane wrote: > > Bruce Momjian <[EMAIL PROTECTED]> writes: > > > This highlights another problem with our plpgsql function caching. > > > > It's a little disturbing to think that any change in SEARCH_PATH might > > force us to discard all cached plans

Re: [BUGS] pl/pgsql problem with search_path

2003-09-06 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > This highlights another problem with our plpgsql function caching. > > It's a little disturbing to think that any change in SEARCH_PATH might > force us to discard all cached plans. That could be expensive; and > consider a function

Re: [BUGS] pl/pgsql problem with search_path

2003-09-06 Thread Bruce Momjian
Eugene Chow wrote: > Thanks. If I had only read the manual before posting. I solved it by > using 'execute' instead of 'select into' since the search_path is not > static in my system. Yep, that's the workaround mentioned in the FAQ. -- Bruce Momjian| http://candle

Re: [BUGS] pl/pgsql problem with search_path

2003-09-06 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > This highlights another problem with our plpgsql function caching. It's a little disturbing to think that any change in SEARCH_PATH might force us to discard all cached plans. That could be expensive; and consider a function that deliberately sets SEARC

Re: [BUGS] pl/pgsql problem with search_path

2003-09-06 Thread Bruce Momjian
I think the problem is that the first time the function is called, it is compiled and cached for later use. At that time the function is bound to the table oid, so even though you change the search path, the cached copy still calls the old table. If you exit psql and re-enter, or change the sche

[BUGS] pl/pgsql problem with search_path

2003-09-06 Thread Eugene Chow
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 tes