From: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> |
---|---|
To: | tgl(at)sss(dot)pgh(dot)pa(dot)us |
Cc: | andreas(at)visena(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: ERROR: attribute number 6 exceeds number of columns 5 |
Date: | 2019-11-27 03:00:34 |
Message-ID: | 20191127.120034.20463388950832898.horikyota.ntt@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
At Tue, 26 Nov 2019 10:49:11 -0500, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote in
> Andreas Joseph Krogh <andreas(at)visena(dot)com> writes:
> > Run the attached script and you'll get:
>
> > psql -f error.sql -d test
> > psql:error.sql:37: ERROR: attribute number 6 exceeds number of columns 5
>
> Hmm, interesting. IMO, that *should* have thrown an error, but of
> course not that one. The ADD COLUMN operations are all processed
> in parallel, so it's not okay for one of them to have a GENERATED
> expression that refers to another one of the new columns. But you
> should have gotten a "no such column" type of error, not a run-time
> cross-check failure.
Something like this works?
ALTER TABLE gtest25 ADD COLUMN x int, ADD COLUMN y int GENERATED ALWAYS AS (x * 4) STORED;
ERROR: column "x" does not exist
DETAIL: An expression cannot reference columns added in the same command.
regards.
--
Kyotaro Horiguchi
NTT Open Source Software Center
Attachment | Content-Type | Size |
---|---|---|
0001-Emit-meaningful-message-for-reference-to-concurrentl.patch | text/x-patch | 3.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Kyotaro Horiguchi | 2019-11-27 03:09:23 | Re: Remove page-read callback from XLogReaderState. |
Previous Message | Alvaro Herrera | 2019-11-27 03:00:14 | Re: progress report for ANALYZE |