Re: Set all variable-length fields of pg_attribute to null on column drop - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Set all variable-length fields of pg_attribute to null on column drop
Date
Msg-id 202312220905.sq4wbn4gwopy@alvherre.pgsql
Whole thread Raw
In response to Set all variable-length fields of pg_attribute to null on column drop  (Peter Eisentraut <peter@eisentraut.org>)
Responses Re: Set all variable-length fields of pg_attribute to null on column drop
List pgsql-hackers
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.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"No hay ausente sin culpa ni presente sin disculpa" (Prov. francés)



pgsql-hackers by date:

Previous
From: Xiaoran Wang
Date:
Subject: Re: Avoid computing ORDER BY junk columns unnecessarily
Next
From: Sébastien Lardière
Date:
Subject: Re: planner chooses incremental but not the best one