Re: GENERATE AS

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: GENERATE AS
Date: 2023-06-22 20:45:15
Message-ID: 328b8fb1-08e8-2c74-a2b8-878ad5e9f9a4@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 6/22/23 15:00, Wetmore, Matthew (CTR) wrote:
>
> Hi, I have this issue and now I’m just wasting time. Can you tell me what
> I’m doing wrong?
>
> I’d like to subtract a column timestamp hour from current hour to give me
> hours elapased.
>
> How do I do this easily?
>
> I think I’ve tried every combination of types and casting.
>
> Thanks in advance.
>
> ---------------------------
>
> 1. ALTER TABLE matt
>
>                add column matt_time timestamp with time zone default
> current_timestamp;
>

Besides what Ilya and David mentioned, CURRENT_TIMESTAMP is based on when
the transaction started.  You might have wanted clock_timestamp().

--
Born in Arizona, moved to Babylonia.

In response to

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

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ron 2023-06-22 20:54:54 Re: GENERATE AS
Previous Message David G. Johnston 2023-06-22 20:25:34 Re: GENERATE AS