Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 9250B29F0D3 for ; Mon, 12 Mar 2012 12:16:32 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S76z9-0003Rv-RY for pgsql-bugs@postgresql.org; Mon, 12 Mar 2012 15:16:32 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q2CFGI7U027130; Mon, 12 Mar 2012 11:16:18 -0400 (EDT) To: Robert Haas cc: rene.vanpaassen@gmail.com, pgsql-bugs@postgresql.org Subject: Re: BUG #6517: Volatile function erroneously optimized, does not consider change in schema path In-reply-to: References: Comments: In-reply-to Robert Haas message dated "Mon, 12 Mar 2012 11:04:21 -0400" Date: Mon, 12 Mar 2012 11:16:18 -0400 Message-ID: <27129.1331565378@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201203/87 X-Sequence-Number: 32648 Robert Haas writes: > On Mon, Mar 5, 2012 at 6:52 AM, 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 ... regards, tom lane