Re: tablecmds.c/MergeAttributes() cleanup

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2023-08-29T08:43:39Z
Lists: pgsql-hackers

Attachments

On 12.07.23 16:29, Peter Eisentraut wrote:
> On 11.07.23 20:17, Alvaro Herrera wrote:
>> I spent a few minutes doing a test merge of this to my branch with NOT
>> NULL changes.  Here's a quick review.
>>
>>> Subject: [PATCH 01/17] Remove obsolete comment about OID support
>>
>> Obvious, trivial.  +1
>>
>>> Subject: [PATCH 02/17] Remove ancient special case code for adding 
>>> oid columns
>>
>> LGTM; deletes dead code.
>>
>>> Subject: [PATCH 03/17] Remove ancient special case code for dropping oid
>>>   columns
>>
>> Hmm, interesting.  Yay for more dead code removal.  Didn't verify it.
> 
> I have committed these first three.  I'll leave it at that for now.

I have committed a few more patches from this series that were already 
agreed upon.  The remaining ones are rebased and reordered a bit, attached.

There was some doubt about the patch "Refactor ATExecAddColumn() to use 
BuildDescForRelation()" (now 0009), whether it's too clever to build a 
fake one-item tuple descriptor.  I am working on another patch, which I 
hope to post this week, that proposes to replace the use of tuple 
descriptors there with a List of something.  That would then allow maybe 
rewriting this in a less-clever way.  That patch incidentally also wants 
to move BuildDescForRelation from tupdesc.c to tablecmds.c (patch 0007 
here).

Commits

  1. Fix segmentation fault in MergeInheritedAttribute()

  2. Improve compression and storage support with inheritance

  3. Split some code out from MergeAttributes()

  4. MergeAttributes code deduplication

  5. Add a const decoration

  6. MergeAttributes: convert pg_attribute back to ColumnDef before comparing

  7. Refactor ATExecAddColumn() to use BuildDescForRelation()

  8. Move BuildDescForRelation() from tupdesc.c to tablecmds.c

  9. Push attcompression and attstorage handling into BuildDescForRelation()

  10. Push attidentity and attgenerated handling into BuildDescForRelation()

  11. Add TupleDescGetDefault()

  12. MergeAttributes() and related variable renaming

  13. Clean up MergeCheckConstraint()

  14. Clean up MergeAttributesIntoExisting()

  15. Remove useless if condition

  16. Make more use of makeColumnDef()

  17. Add some const decorations

  18. Remove ancient special case code for dropping oid columns

  19. Remove ancient special case code for adding oid columns

  20. Remove obsolete comment about OID support