generated column cast from timestamptz to timestamp not OK.

Поиск
Список
Период
Сортировка
От alias
Тема generated column cast from timestamptz to timestamp not OK.
Дата
Msg-id CAJA4AWRedm=hZAve7gU9OyPKM_9Jx30i7Mi7n5-Sc5bu9JX1OQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: generated column cast from timestamptz to timestamp not OK.  (Francisco Olarte <folarte@peoplecall.com>)
Список pgsql-general

CREATE TABLE test_g (
    a timestamptz,
    b timestamp GENERATED ALWAYS AS (a::timestamp) STORED
);
then an error occurred.
ERROR:  42P17: generation expression is not immutable
LOCATION:  cookDefault, heap.c:2768

However  the following 2 commands is ok.

CREATE TABLE test_i (
    a int,
    b bigint GENERATED ALWAYS AS (a::bigint) STORED
);
 
CREATE TABLE test_c (
    a varchar,
    b text GENERATED ALWAYS AS (a::text) STORED
);

I didn't get it. timestamptz changes then timestamp also changes. timestamp is part of timestamptz... 
Even if column timestamptz is some value that is constantly changing (like now() ), it changes/updates then just in the mean time captures timestamp to column b.



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

Предыдущее
От: Bryn Llewellyn
Дата:
Сообщение: Re: Deferred constraint trigger semantics
Следующее
От: Francisco Olarte
Дата:
Сообщение: Re: generated column cast from timestamptz to timestamp not OK.