From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-admin@lists.postgresql.org
Subject: Re: GENERATE AS
Date: Thu, 22 Jun 2023 15:45:15 -0500
Message-ID: <328b8fb1-08e8-2c74-a2b8-878ad5e9f9a4@gmail.com> (raw)
In-Reply-To: <7c48174f8ce449af8f3e875bdeca7150@express-scripts.com>
References: <7c48174f8ce449af8f3e875bdeca7150@express-scripts.com>
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.
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: ronljohnsonjr@gmail.com, pgsql-admin@lists.postgresql.org
Subject: Re: GENERATE AS
In-Reply-To: <328b8fb1-08e8-2c74-a2b8-878ad5e9f9a4@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