Re: Can't find the right generated column syntax

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: Can't find the right generated column syntax
Дата
Msg-id a463c0e3d43bfc7c6da8de57a70270893217b82f.camel@cybertec.at
обсуждение исходный текст
Ответ на Can't find the right generated column syntax  (Bzzzz <lazyvirus@gmx.com>)
Список 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




В списке pgsql-novice по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Can't find the right generated column syntax
Следующее
От: Yessica Brinkmann
Дата:
Сообщение: CurrentMemoryContext and MemoryContextStrdup