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

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Set all variable-length fields of pg_attribute to null on column drop
Date: 2023-11-30 11:23:46
Message-ID: 249d819d-1763-4580-8110-0bf91a0f08b7@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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).

I suggest the attached patch to set those fields to null when a column
is marked as dropped.

Attachment Content-Type Size
v1-0001-Set-all-variable-length-fields-of-pg_attribute-to.patch text/plain 2.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2023-11-30 11:29:17 RE: Is this a problem in GenericXLogFinish()?
Previous Message Ashutosh Bapat 2023-11-30 11:05:11 Re: Report planning memory in EXPLAIN ANALYZE