Search Postgresql Archives

generated column cast from timestamptz to timestamp not OK.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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.




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux