Generated column and string concatenation issue
От | Manuel Rigger |
---|---|
Тема | Generated column and string concatenation issue |
Дата | |
Msg-id | CA+u7OA6AD9OLziFW+io1HgN8q_XH0o1Y5RyufXYO5=0fnhG5zQ@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Generated column and string concatenation issue
|
Список | pgsql-bugs |
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
В списке pgsql-bugs по дате отправления: