pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Davis <pgsql@j-davis.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: possible bug seen with -DCLOBBER_CACHE_ALWAYS and changing GUCs
Date: Tue, 06 Dec 2011 00:35:59 -0500
Message-ID: <11651.1323149759@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMp0ubdy2Am4jA7ri875VJ6-9FR7TkkR7Lx3Kjvak+aFukG_-w@mail.gmail.com>
References: <CAMp0ubdWEv63h4x_cap_LKUcXGcbS7++3GyQaJrMq9pAHVCoSA@mail.gmail.com>
	<4161.1322701822@sss.pgh.pa.us>
	<CAMp0ubdy2Am4jA7ri875VJ6-9FR7TkkR7Lx3Kjvak+aFukG_-w@mail.gmail.com>

Jeff Davis <pgsql@j-davis.com> writes:
> On Wed, Nov 30, 2011 at 5:10 PM, Tom Lane <tgl@sss.pgh.pa.us> 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



view thread (6+ messages)

Message-ID: <11651.1323149759@sss.pgh.pa.us>
Permalink:  ../11651.1323149759@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11651.1323149759@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql@j-davis.com
  Subject: Re: possible bug seen with -DCLOBBER_CACHE_ALWAYS and changing GUCs
  In-Reply-To: <11651.1323149759@sss.pgh.pa.us>
  References: <CAMp0ubdWEv63h4x_cap_LKUcXGcbS7++3GyQaJrMq9pAHVCoSA@mail.gmail.com> <4161.1322701822@sss.pgh.pa.us> <CAMp0ubdy2Am4jA7ri875VJ6-9FR7TkkR7Lx3Kjvak+aFukG_-w@mail.gmail.com> <11651.1323149759@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox