Re: BUG #6517: Volatile function erroneously optimized, does not consider change in schema path

From: Rene van Paassen <rene(dot)vanpaassen(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6517: Volatile function erroneously optimized, does not consider change in schema path
Date: 2012-03-14 08:22:42
Message-ID: CAOVCA=u-cYhy3BpweJxVWMExGNweJmUOEz5Bo61y064RR2_0zw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 12 March 2012 16:16, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> > On Mon, Mar 5, 2012 at 6:52 AM, <rene(dot)vanpaassen(at)gmail(dot)com> wrote:
> >> I found some unexpected behaviour when changing the schema search path
> in
> >> combination with plpgsql functions (may be true for other function types
> >> too, did not check). This occurs both in 9.1.2 (on Fedora, 64 bit) and
> 8.4.9
> >> (Centos 6, 32 bit). I created a small example run with psql, to
> demonstrate
> >> this.
>
> > I have a vague feeling this is a known issue. It sure seems like we
> > should handle it better, but I'm not sure how hard that would be to
> > implement.
>
> plpgsql intentionally caches the plan for the query as it was built with
> the original search_path. There's been talk of adjusting that behavior
> but I'm worried that we might break as many cases as we fix ...
>

But since I can work around the problem by closing and opening the database
connection, the "original search_path" is thus the search path that the
function happened to run in for the first time with the current database
connection.

--
René van Paassen | ______o____/_| Rene(dot)vanPaassen(at)gmail(dot)com
<[___\_\_-----< t: +31 15 2628685
| o' mobile: +31 6 39846891

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message claudiomsi 2012-03-14 16:07:00 BUG #6531: integrity constraint failure
Previous Message Rene van Paassen 2012-03-14 08:13:29 Re: BUG #6517: Volatile function erroneously optimized, does not consider change in schema path