From: | Manuel Rigger <rigger(dot)manuel(at)gmail(dot)com> |
---|---|
To: | PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Generated column and string concatenation issue |
Date: | 2019-07-10 14:22:09 |
Message-ID: | CA+u7OA6AD9OLziFW+io1HgN8q_XH0o1Y5RyufXYO5=0fnhG5zQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2019-07-10 14:47:52 | Re: Generated column and string concatenation issue |
Previous Message | David G. Johnston | 2019-07-10 13:52:06 | Re: BUG #15903: Getting error |