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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(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-11-30 16:45:09
Message-ID: CA+TgmobLKU+Naw8mk2qDYfqHQZ3xwvyNRaORWRVyzN4-G-kEew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 30, 2023 at 6:24 AM Peter Eisentraut <peter(at)eisentraut(dot)org> 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).
>
> I suggest the attached patch to set those fields to null when a column
> is marked as dropped.

I haven't reviewed the patch, but +1 for the idea.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2023-11-30 16:46:04 Re: pg_upgrade and logical replication
Previous Message vignesh C 2023-11-30 16:25:21 Re: pg_upgrade and logical replication