Re: BUG #18297: Error when adding a column to a parent table with complex inheritance

From: Tender Wang <tndrwang(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: 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 15:03:56
Message-ID: CAHewXNnhOgY4jTHKa2F1zJdtxUECmEMzV_VANnCNTuL3+_Bx6A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thanks for reviewing the patch.
The attached v2 patch includes all review advices.

--
Tender Wang
OpenPie: https://en.openpie.com/

Richard Guo <guofenglinux(at)gmail(dot)com> 于2024年1月17日周三 19:54写道:

>
> On Wed, Jan 17, 2024 at 3:48 PM Tender Wang <tndrwang(at)gmail(dot)com> wrote:
>
>> 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.
>>
>
> Indeed. We may update the same child column multiple times, but there
> is no CommandCounterIncrement between. Nice catch and +1 to the fix.
>
> To nitpick, how about go with the comment as
>
> /* Make sure the child column change is visible */
>
> which seems clearer.
>
> Also I think it'd be better to include a blank line before and after the
> new CommandCounterIncrement statement.
>
> Also I suggest to drop the new added tables after we've run ALTER TABLE
> in the test case.
>
> Thanks
> Richard
>

Attachment Content-Type Size
v2-0001-Fix-self-updated-tuple-invisible-for-catalog-tupl.patch application/octet-stream 3.1 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Leo Gaspard 2024-01-17 18:53:01 jsonb numerics are treated as arrays
Previous Message Daniel Gustafsson 2024-01-17 14:37:53 Re: pg_basebackup: errors on macOS on directories with ".DS_Store" files