Re: tablecmds.c/MergeAttributes() cleanup
Peter Eisentraut <peter@eisentraut.org>
Attachments
- v3-0001-Clean-up-MergeAttributesIntoExisting.patch (text/plain) patch v3-0001
- v3-0002-Clean-up-MergeCheckConstraint.patch (text/plain) patch v3-0002
- v3-0003-MergeAttributes-and-related-variable-renaming.patch (text/plain) patch v3-0003
- v3-0004-Add-TupleDescGetDefault.patch (text/plain) patch v3-0004
- v3-0005-Push-attidentity-and-attgenerated-handling-into-B.patch (text/plain) patch v3-0005
- v3-0006-Move-BuildDescForRelation-from-tupdesc.c-to-table.patch (text/plain) patch v3-0006
- v3-0007-Push-attcompression-and-attstorage-handling-into-.patch (text/plain) patch v3-0007
- v3-0008-Refactor-ATExecAddColumn-to-use-BuildDescForRelat.patch (text/plain) patch v3-0008
- v3-0009-MergeAttributes-convert-pg_attribute-back-to-Colu.patch (text/plain) patch v3-0009
On 29.08.23 13:20, Alvaro Herrera wrote: > On 2023-Aug-29, Peter Eisentraut wrote: >> @@ -3278,13 +3261,16 @@ MergeAttributes(List *schema, List *supers, char relpersistence, >> * >> * constraints is a list of CookedConstraint structs for previous constraints. >> * >> - * Returns true if merged (constraint is a duplicate), or false if it's >> - * got a so-far-unique name, or throws error if conflict. >> + * If the constraint is a duplicate, then the existing constraint's >> + * inheritance count is updated. If the constraint doesn't match or conflict >> + * with an existing one, a new constraint is appended to the list. If there >> + * is a conflict (same name but different expression), throw an error. > > This wording confused me: > > "If the constraint doesn't match or conflict with an existing one, a new > constraint is appended to the list." > > I first read it as "doesn't match or conflicts with ..." (i.e., the > negation only applied to the first verb, not both) which would have been > surprising (== broken) behavior. > > I think it's clearer if you say "doesn't match nor conflict", but I'm > not sure if this is grammatically correct. Here is an updated version of this patch set. I resolved some conflicts and addressed this comment of yours. I also dropped the one patch with some catalog header edits that people didn't seem to particularly like. The patches that are now 0001 through 0004 were previously reviewed and just held for the not-null constraint patches, I think, so I'll commit them in a few days if there are no objections. Patches 0005 through 0007 are also ready in my opinion, but they haven't really been reviewed, so this would be something for reviewers to focus on. (0005 and 0007 are trivial, but they go to together with 0006.) The remaining 0008 and 0009 were still under discussion and contemplation.
Commits
-
Fix segmentation fault in MergeInheritedAttribute()
- 8f0a97dfffc5 17.0 landed
-
Improve compression and storage support with inheritance
- 0413a556990b 17.0 cited
-
Split some code out from MergeAttributes()
- f7cf9494bad3 17.0 landed
-
MergeAttributes code deduplication
- 64444ce071f6 17.0 landed
-
Add a const decoration
- 924d046dcf55 17.0 landed
-
MergeAttributes: convert pg_attribute back to ColumnDef before comparing
- 4d969b2f85e1 17.0 landed
-
Refactor ATExecAddColumn() to use BuildDescForRelation()
- a1604237a6ff 17.0 landed
-
Move BuildDescForRelation() from tupdesc.c to tablecmds.c
- 04e485273b56 17.0 landed
-
Push attcompression and attstorage handling into BuildDescForRelation()
- 180e3394a704 17.0 landed
-
Push attidentity and attgenerated handling into BuildDescForRelation()
- 6d341407a6e3 17.0 landed
-
Add TupleDescGetDefault()
- ebf76f2753a9 17.0 landed
-
MergeAttributes() and related variable renaming
- b0ae29512c21 17.0 landed
-
Clean up MergeCheckConstraint()
- 369202bf4be6 17.0 landed
-
Clean up MergeAttributesIntoExisting()
- eddad679d2ab 17.0 landed
-
Remove useless if condition
- 6844d3275ac6 17.0 landed
- 689c66a84bb7 17.0 landed
-
Make more use of makeColumnDef()
- 1fa9241bdd0e 17.0 landed
-
Add some const decorations
- 2b088c8e4a2c 17.0 landed
-
Remove ancient special case code for dropping oid columns
- 7ef2912519fd 17.0 landed
-
Remove ancient special case code for adding oid columns
- 5eaa0e92ee2f 17.0 landed
-
Remove obsolete comment about OID support
- adf333b4edb2 17.0 landed