Re: GENERATE AS

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "Wetmore, Matthew (CTR)" <Matthew(dot)Wetmore(at)express-scripts(dot)com>
Cc: "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: GENERATE AS
Date: 2023-06-22 20:08:38
Message-ID: CAKFQuwbgETyn7DoEBT3CzhZzwfhUa_Z=AGbhTGqqgn1=Vgsf7A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, Jun 22, 2023 at 1:00 PM Wetmore, Matthew (CTR) <
Matthew(dot)Wetmore(at)express-scripts(dot)com> wrote:

> Hi, I have this issue and now I’m just wasting time. Can you tell me what
> I’m doing wrong?
>

Like the error message says - you are trying to use a generated
expression when one of the inputs is volatile (or, is not immutable).

It makes no sense to store "hours elapsed" when the concept of current time
(an ever changing concept) is being used in the formula. Create a view
with you expression then the view can always provide an accurate value for
elapsed time as of when the query is run.

David J.

In response to

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

Browse pgsql-admin by date

  From Date Subject
Next Message Ilya Kosmodemiansky 2023-06-22 20:13:28 Re: GENERATE AS
Previous Message Wetmore, Matthew (CTR) 2023-06-22 20:00:31 GENERATE AS