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

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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: rene(dot)vanpaassen(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-12 15:32:46
Message-ID: CA+Tgmoa3bQM72JfFoZSFV5sTohaY9B48tasmq5U4dkYJ0nruLg@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On Mon, Mar 12, 2012 at 11:16 AM, 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 ...

IMHO, the problem with the current behavior is that it's neither all
one thing nor all the other.  Using the definition-time search_path
seems defensible, and using the run-time search_path does, too.  But
we're not consistently doing either one, which doesn't seem good.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

pgsql-bugs by date

Next:From: Robert HaasDate: 2012-03-12 15:33:33
Subject: Re: BUG #6484: pgstat wait timeout
Previous:From: Tom LaneDate: 2012-03-12 15:23:44
Subject: Re: BUG #6513: explain (analyze, buffers) and toasted fields

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