From: | Tender Wang <tndrwang(at)gmail(dot)com> |
---|---|
To: | exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #18297: Error when adding a column to a parent table with complex inheritance |
Date: | 2024-01-17 07:48:23 |
Message-ID: | CAHewXNkjMSzka_sGjtSysDRZpG93j5a=8ebq6f3Gcuo-xAGygw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hmm, thanks for the report.
I can repeat the aboved issue on master, even on pg10 and pg 11.
I analyzed this issue, and I found that ATExecAddColumn(), we forgot to
call CommandCounterIncrement() in if (colDef->inhcount > 0) {...} branch.
So the third(a->d) updates the first(a->b->c->d) tuple.
Attached patch is my quickly fixed solution.
--
Tender Wang
OpenPie: https://en.openpie.com/
PG Bug reporting form <noreply(at)postgresql(dot)org> 于2024年1月16日周二 17:32写道:
> The following bug has been logged on the website:
>
> Bug reference: 18297
> Logged by: Alexander Lakhin
> Email address: exclusion(at)gmail(dot)com
> PostgreSQL version: 16.1
> Operating system: Ubuntu 22.04
> Description:
>
> The following query:
> CREATE TABLE a ();
> CREATE TABLE b () INHERITS (a);
> CREATE TABLE c () INHERITS (b);
> CREATE TABLE d () INHERITS (a,b,c);
>
> ALTER TABLE a ADD COLUMN i int;
> fails with:
> NOTICE: merging definition of column "i" for child "d"
> ERROR: tuple already updated by self
>
> While with a simpler hierarchy:
> CREATE TABLE a ();
> CREATE TABLE b () INHERITS (a);
> CREATE TABLE c () INHERITS (a,b);
>
> the column added successfully:
> ALTER TABLE a ADD COLUMN i int;
> NOTICE: merging definition of column "i" for child "c"
> ALTER TABLE
>
> In the failed case the error occurred when table d was processed the third
> time. First (following chain a -> b -> c-> d) the table got the column i
> added, second (a -> b -> d) it got merged column definition, third
> (a -> d) an attempt to merge the column definition once more failed.
>
> This error can be seen at least on REL_12_STABLE .. master.
>
>
Attachment | Content-Type | Size |
---|---|---|
0001-Fix-self-updated-tuple-invisible-for-catalog-tuple.patch | application/octet-stream | 3.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Gustafsson | 2024-01-17 08:16:30 | Re: BUG #18299: yum.postgresql.org/keys website is down (404 error) and can't download keys |
Previous Message | Yang Zhu | 2024-01-17 06:07:54 | Re: BUG #18283: vacuum full use a large amount of memory (may cause OOM) |