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.

Reply via email to