pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Paul Förster <paul.foerster@gmail.com>
To: Michael Lewis <mlewis@entrata.com>
Cc: Anders Steinlein <anders@e5r.no>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: Different results from identical matviews
Date: Thu, 2 Jul 2020 15:08:12 +0200
Message-ID: <2553D145-15CC-4A52-A8B9-850A1650F8F7@gmail.com> (raw)
In-Reply-To: <CAHOFxGp_yXW4+y-6L_6+18OjPzxe2wb6ua0hFVOKnbnYJpJtqQ@mail.gmail.com>
References: <CAC35HNnNGavaZ=P=rUcwTwYEhfoyXDg32REXCRDgxBmC3No3nA@mail.gmail.com>
	<815598.1593648137@sss.pgh.pa.us>
	<CAC35HN=QPcSAw+Y47tOCZ51PysSgYzoO5bT7AK3q8VPvB8ZCcQ@mail.gmail.com>
	<CAC35HNnGNOx9+jySpUffYAVrhiKYGHU3-qf8KYXL=H2mr7c_Sg@mail.gmail.com>
	<CAHOFxGp_yXW4+y-6L_6+18OjPzxe2wb6ua0hFVOKnbnYJpJtqQ@mail.gmail.com>

Hi Michael,

> On 02. Jul, 2020, at 14:55, Michael Lewis <mlewis@entrata.com> wrote:
> 
> Is now() computed at the time the view is defined and not at refresh? If this were a function, I would be more suspicious of that but a plain view, surely not. I hope.

now() returns the time at the beginning of the transaction:

see: https://www.postgresql.org/docs/current/functions-datetime.html

If you want the time whenever you call the function, use clock_timestamp() instead. There's also a good article at:

https://www.cybertec-postgresql.com/en/postgresql-now-vs-nowtimestamp-vs-clock_timestamp/

Hope this helps.

Cheers,
Paul




view thread (21+ messages)  latest in thread

Message-ID: <2553D145-15CC-4A52-A8B9-850A1650F8F7@gmail.com>
Permalink:  ../2553D145-15CC-4A52-A8B9-850A1650F8F7@gmail.com/
Also on:    postgresql.org/message-id/2553D145-15CC-4A52-A8B9-850A1650F8F7@gmail.com

 · 

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-general@postgresql.org
  Cc: paul.foerster@gmail.com, mlewis@entrata.com, anders@e5r.no, tgl@sss.pgh.pa.us
  Subject: Re: Different results from identical matviews
  In-Reply-To: <2553D145-15CC-4A52-A8B9-850A1650F8F7@gmail.com>
  References: <CAC35HNnNGavaZ=P=rUcwTwYEhfoyXDg32REXCRDgxBmC3No3nA@mail.gmail.com> <815598.1593648137@sss.pgh.pa.us> <CAC35HN=QPcSAw+Y47tOCZ51PysSgYzoO5bT7AK3q8VPvB8ZCcQ@mail.gmail.com> <CAC35HNnGNOx9+jySpUffYAVrhiKYGHU3-qf8KYXL=H2mr7c_Sg@mail.gmail.com> <CAHOFxGp_yXW4+y-6L_6+18OjPzxe2wb6ua0hFVOKnbnYJpJtqQ@mail.gmail.com> <2553D145-15CC-4A52-A8B9-850A1650F8F7@gmail.com>

* 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