pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Ilya Kosmodemiansky <ik@dataegret.com>
Cc: Wetmore, Matthew (CTR) <Matthew.Wetmore@express-scripts.com>
Cc: pgsql-admin@lists.postgresql.org
Subject: Re: GENERATE AS
Date: Thu, 22 Jun 2023 17:15:05 -0400
Message-ID: <4108564.1687468505@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwbJcON2=Ky9rDNJdUGa8iuu6nYnPnRa_jr85iRkCokKww@mail.gmail.com>
References: <7c48174f8ce449af8f3e875bdeca7150@express-scripts.com>
	<D598E4B1-1B40-4B55-89A2-9296CDD2985D@dataegret.com>
	<CAKFQuwbJcON2=Ky9rDNJdUGa8iuu6nYnPnRa_jr85iRkCokKww@mail.gmail.com>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> The problem here is not timezone related - it is more fundamental in that
> the stored data does not change but the expression, as time progresses, is
> going to give different values and thus make what is stored incorrect.

Right --- current_timestamp in a generation expression makes no sense.
(There's also an issue about whether the surrounding calculation
is timezone-dependent, but that could be fixed up.  Depending on
current time cannot be.)

You could create a view in which this value is an extra computed column,
but you can't do it as a stored generated column.

			regards, tom lane





view thread (9+ messages)  latest in thread

Message-ID: <4108564.1687468505@sss.pgh.pa.us>
Permalink:  ../4108564.1687468505@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4108564.1687468505@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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, ik@dataegret.com, Matthew.Wetmore@express-scripts.com, pgsql-admin@lists.postgresql.org
  Subject: Re: GENERATE AS
  In-Reply-To: <4108564.1687468505@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