generated column cast from timestamptz to timestamp not OK. - Mailing list pgsql-general

From alias
Subject generated column cast from timestamptz to timestamp not OK.
Date
Msg-id CAJA4AWRedm=hZAve7gU9OyPKM_9Jx30i7Mi7n5-Sc5bu9JX1OQ@mail.gmail.com
Whole thread Raw
Responses Re: generated column cast from timestamptz to timestamp not OK.
List 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 by date:

Previous
From: Bryn Llewellyn
Date:
Subject: Re: Deferred constraint trigger semantics
Next
From: Francisco Olarte
Date:
Subject: Re: generated column cast from timestamptz to timestamp not OK.