| From: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
|---|---|
| To: | Bzzzz <lazyvirus(at)gmx(dot)com>, pgsql-novice <pgsql-novice(at)postgresql(dot)org> |
| Subject: | Re: Can't find the right generated column syntax |
| Date: | 2019-11-26 07:10:19 |
| Message-ID: | a463c0e3d43bfc7c6da8de57a70270893217b82f.camel@cybertec.at |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
On Tue, 2019-11-26 at 03:30 +0100, Bzzzz wrote:
> I've got this table:
> date_start timestamptz,
> date_end temstamptz
>
> and I'd like to auto-generate a 3rd column with a tstzrange:
> date_start timestamptz,
> date_end temstamptz,
> duration tstzrange GENERATED ALWAYS AS ( ? ) STORED
>
> but I can't find the right syntax to do so :/ (is it even possible ?)
That should be as simple as
GENERATED ALWAYS AS (tstzrange(date_start, date_end)) STORED
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Yessica Brinkmann | 2019-11-26 13:57:55 | CurrentMemoryContext and MemoryContextStrdup |
| Previous Message | David G. Johnston | 2019-11-26 03:58:29 | Re: Can't find the right generated column syntax |