pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: bert@brothom.nl
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6761: unexpected behaviour of 'now'::timestamp
Date: Wed, 25 Jul 2012 12:53:03 -0400
Message-ID: <28436.1343235183@sss.pgh.pa.us> (raw)
In-Reply-To: <CAFj8pRD6mmx3e7tSHn_W-vsu8L68H+k3N9d7OLVFT=jNfviSFg@mail.gmail.com>
References: <E1Su15J-0001Oj-Ja@wrigleys.postgresql.org>
	<CAFj8pRD6mmx3e7tSHn_W-vsu8L68H+k3N9d7OLVFT=jNfviSFg@mail.gmail.com>

Pavel Stehule <pavel.stehule@gmail.com> writes:
> this is not bug - it is consequence of plan cache

FWIW, there is documentation of this issue near the end of
http://www.postgresql.org/docs/9.1/static/plpgsql-implementation.html#PLPGSQL-PLAN-CACHING

This exact case isn't covered in the examples, but the point is that the
expression 'now'::timestamp will get folded to a timestamp constant during
planning, and then not replanned later.  As Pavel says, it's a lot safer
to use one of the variants of the now() function.

			regards, tom lane



view thread (4+ messages)  latest in thread

Message-ID: <28436.1343235183@sss.pgh.pa.us>
Permalink:  ../28436.1343235183@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/28436.1343235183@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, pavel.stehule@gmail.com, bert@brothom.nl
  Subject: Re: BUG #6761: unexpected behaviour of 'now'::timestamp
  In-Reply-To: <28436.1343235183@sss.pgh.pa.us>
  References: <E1Su15J-0001Oj-Ja@wrigleys.postgresql.org> <CAFj8pRD6mmx3e7tSHn_W-vsu8L68H+k3N9d7OLVFT=jNfviSFg@mail.gmail.com> <28436.1343235183@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