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

Поиск
Список
Период
Сортировка
От Richard Guo
Тема Re: BUG #18297: Error when adding a column to a parent table with complex inheritance
Дата
Msg-id CAMbWs48DPeuusHFaZ8xk=ag6TbhfqtF9KUEUMmb3nY7zPYCBdA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #18297: Error when adding a column to a parent table with complex inheritance  (Tender Wang <tndrwang@gmail.com>)
Ответы Re: BUG #18297: Error when adding a column to a parent table with complex inheritance  (Tender Wang <tndrwang@gmail.com>)
Список pgsql-bugs

On Wed, Jan 17, 2024 at 3:48 PM Tender Wang <tndrwang@gmail.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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #18301: version mismatch
Следующее
От: Daniel Gustafsson
Дата:
Сообщение: Re: pg_basebackup: errors on macOS on directories with ".DS_Store" files