Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 9B0458ECFC1 for ; Tue, 6 Dec 2011 01:36:18 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RXnhO-0002F4-Fw for pgsql-bugs@postgresql.org; Tue, 06 Dec 2011 05:36:18 +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 pB65ZxKj011652; Tue, 6 Dec 2011 00:35:59 -0500 (EST) To: Jeff Davis cc: pgsql-bugs@postgresql.org Subject: Re: possible bug seen with -DCLOBBER_CACHE_ALWAYS and changing GUCs In-reply-to: References: <4161.1322701822@sss.pgh.pa.us> Comments: In-reply-to Jeff Davis message dated "Mon, 05 Dec 2011 17:29:27 -0800" Date: Tue, 06 Dec 2011 00:35:59 -0500 Message-ID: <11651.1323149759@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -3.1 (---) X-Archive-Number: 201112/46 X-Sequence-Number: 31857 Jeff Davis writes: > On Wed, Nov 30, 2011 at 5:10 PM, Tom Lane wrote: >> The result of parse analysis for that query is a stored date constant >> (in a Const node) with a cast-to-text on top of it. The system is aware >> that cast-date-to-text isn't immutable, so it doesn't try to fold the >> cast operation. When you execute the query, it displays the date >> constant using the now-current datestyle. > Another thought: why does it execute the type input function (which is > dependent on a GUC), but not the cast? It's historical, see parse_coerce.c around line 210: * XXX if the typinput function is not immutable, we really ought to * postpone evaluation of the function call until runtime. But there * is no way to represent a typinput function call as an expression * tree, because C-string values are not Datums. (XXX This *is* * possible as of 7.3, do we want to do it?) (Of course, the parenthetical comment is a good deal newer than what precedes it.) However, I don't think this is the core issue. What is the core issue is how many GUC settings we would like to save and reinstate for every cached plan. We do that now for search_path because of the potential security implications, but the costs of doing it for all of 'em seem a tad daunting; not to mention that somebody is going to complain that that's not the behavior he wanted. regards, tom lane