Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tu6vJ-0005hI-07 for pgsql-bugs@arkaria.postgresql.org; Sat, 12 Jan 2013 19:39:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Tu6vH-0005iU-Tp for pgsql-bugs@arkaria.postgresql.org; Sat, 12 Jan 2013 19:39:19 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tu6vG-0005i8-Vb for pgsql-bugs@postgresql.org; Sat, 12 Jan 2013 19:39:19 +0000 Received: from moutng.kundenserver.de ([212.227.17.8]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tu6vF-00047r-11 for pgsql-bugs@postgresql.org; Sat, 12 Jan 2013 19:39:18 +0000 Received: from anarazel.de (p5DDC5A47.dip.t-dialin.net [93.220.90.71]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0MNh30-1TsQt71TJK-007f30; Sat, 12 Jan 2013 20:39:07 +0100 Received: by anarazel.de (Postfix, from userid 1000) id 92B161C0177; Sat, 12 Jan 2013 20:39:06 +0100 (CET) Date: Sat, 12 Jan 2013 20:39:06 +0100 From: Andres Freund To: Tom Lane Cc: Kevin Grittner , Rodrigo Rosenfeld Rosas , pgsql-bugs@postgresql.org Subject: Re: wrong search_path being used Message-ID: <20130112193906.GC21523@awork2.anarazel.de> References: <20130112185917.255770@gmx.com> <21642.1358018978@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <21642.1358018978@sss.pgh.pa.us> X-Provags-ID: V02:K0:dIAYKtNBjV+eUahsIKKs5qpHUrnN0cYKozeKC+Ne2Ag lnia/ypTTKiluciJOYXA/A0eR4SsJvABNxCsbq6j20tilj/qXV vZC7reD/zYdGVjUdfUXshPATmWlOKAqN4ViDrfFbgm38ftE41e xGbGCjE8IfV443dURA4nZ/QXojGOe9Pg0J66SNA9dYWgkZXRC/ wiaGRTBiY7Sdo2uG/S/p0QOBTuJXswmKwnRWuyy1q+ksJg6EDd dyG+QIby1ZjHU0P+/mzIf6Gj8n0EllH4zif7RhzzsyRiB28gYY umMTCp8Lb7Z4EDNisM5qGkSUkHIsetxjSfG7pnV2BX2zbE3hCn LEW/SBevJRdFloVVyZdwNs/1vq60uhJDBFHbsf3V1 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 2013-01-12 14:29:38 -0500, Tom Lane wrote: > "Kevin Grittner" writes: > > To try to get your function code to work as you expect, the > > language would essentially need to identify which statements could > > be pre-planned, and which would needed to be treated as raw source > > on each execution. That would be tricky to implement, and would > > itself have some run-time cost. At this point we've put the burden > > on the programmer to identify this at the time the code is written, > > rather than adding run-time expense. > > I think that the alternative most likely to succeed is to consider any > change in the active value of search_path as forcing replanning of > cached plans. This wouldn't be that hard to implement but there's > a definite risk of loss of performance due to unnecessary replanning > (since the path change might or might not affect the particular query). > It's also not unlikely that it could break applications that work today, > because they depend -- perhaps without being aware of it -- on the > existing first-path-wins behavior. > > Having said that, it seems likely that more people would prefer that > behavior than the existing one. But it hasn't been clear enough to > justify making such a subtly incompatible change. Its a somewhat common practise to use SET in functions or as a configuration parameter to functions. I think at least the latter should still work without forcing to replan any query. Given that we advice setting the search path for SECURITY DEFINER... I guess it wouldn't really be feasible to keep the search path used to plan a query in its cached form and check that it fits the one currently used on every use of the cached plan? Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs