Re: BUG #18297: Error when adding a column to a parent table with complex inheritance
Alexander Law <exclusion@gmail.com>
From: Alexander Lakhin <exclusion@gmail.com>
To: Tender Wang <tndrwang@gmail.com>, Richard Guo <guofenglinux@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2024-01-18T09:00:01Z
Lists: pgsql-bugs
Hello Tender Wang and Richard, 17.01.2024 18:03, Tender Wang wrote: > Thanks for reviewing the patch. > The attached v2 patch includes all review advices. > > -- > Tender Wang > OpenPie: https://en.openpie.com/ > > Richard Guo <guofenglinux@gmail.com> 于2024年1月17日周三 19:54写道: > > > 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 > Thank you for working on this! (Maybe it's possible to slightly modify an existing hierarchy with tables a, b, c in inherit.sql for the purpose of the check added.) I've found another situation where the same error is produced: CREATE ROLE u; DROP ROLE u, u; ERROR: tuple already updated by self Perhaps, you would like to fix it in passing too. I've rechecked all the other object types, that can be DROPped with a list (namely, AGGREGATE, DOMAIN, EXTENSION, FOREIGN DATA WRAPPER, FOREIGN TABLE, FUNCTION, INDEX, MATERIALIZED VIEW, OPERATOR, PROCEDURE, ROUTINE, SEQUENCE, SERVER, STATISTICS, TABLE, TYPE, VIEW), and found that all of these handle such duplicate entries with no error. Best regards, Alexander
Commits
-
Fix ALTER TABLE .. ADD COLUMN with complex inheritance trees
- 2f724283719e 12.18 landed
- bfec14d06de8 13.14 landed
- 5a7833f49679 14.11 landed
- ad6fbbeeb07a 15.6 landed
- 51193e7a7d33 16.2 landed
- bb812ab0917e 17.0 landed