Re: GENERATE AS

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Ilya Kosmodemiansky <ik(at)dataegret(dot)com>, "Wetmore, Matthew (CTR)" <Matthew(dot)Wetmore(at)express-scripts(dot)com>, pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: GENERATE AS
Date: 2023-06-22 21:15:05
Message-ID: 4108564.1687468505@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)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

In response to

Responses

  • GENERATE AS at 2023-06-22 22:00:47 from Wetmore, Matthew (CTR)

Browse pgsql-admin by date

  From Date Subject
Next Message Wetmore, Matthew (CTR) 2023-06-22 22:00:47 GENERATE AS
Previous Message Ron 2023-06-22 20:54:54 Re: GENERATE AS