Hi everyone,
Consider the following statement:
CREATE TABLE t0(c0 TEXT GENERATED ALWAYS AS (('abc' || 1)) STORED); --
unexpected: generation expression is not immutable
I would expect that this table can be created. However, I get the
following error message: "ERROR: generation expression is not
immutable". The documentation [1] mentions several restrictions for
generated columns, but I did not see any restrictions on operators (or
is string concatenation considered to be a function?).
Adding an explicit cast to string on the non-string argument results
in no error being shown:
CREATE TABLE t0(c0 TEXT GENERATED ALWAYS AS (('abc' || 1::TEXT))
STORED); -- expected: no error
I'm using the following Postgres version: 12beta2 (Debian 12~beta2-1.pgdg90+1)
Best,
Manuel
[1] https://www.postgresql.org/docs/devel/ddl-generated-columns.html