Re: Set all variable-length fields of pg_attribute to null on column drop

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Set all variable-length fields of pg_attribute to null on column drop
Date: 2023-12-22 21:01:01
Message-ID: d005d422-ace3-42ab-b471-0463a29727f5@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 22.12.23 10:05, Alvaro Herrera wrote:
> On 2023-Nov-30, Peter Eisentraut wrote:
>
>> I noticed that when a column is dropped, RemoveAttributeById() clears out
>> certain fields in pg_attribute, but it leaves the variable-length fields at
>> the end (attacl, attoptions, and attfdwoptions) unchanged. This is probably
>> harmless, but it seems wasteful and unclean, and leaves potentially dangling
>> data lying around (for example, attacl could contain references to users
>> that are later also dropped).
>
> Yeah, this looks like an ancient oversight -- when DROP COLUMN was added
> we didn't have any varlena fields in this catalog, and when the first
> one was added (attacl in commit 3cb5d6580a33) resetting it on DROP
> COLUMN was overlooked.
>
> LGTM.

committed

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Christensen 2023-12-22 21:24:50 Re: [PATCHES] Post-special page storage TDE support
Previous Message Thomas Munro 2023-12-22 20:52:59 Re: pg_upgrade --copy-file-range