Re: let ALTER TABLE DROP COLUMN drop whole-row referenced object - Mailing list pgsql-hackers

From jian he
Subject Re: let ALTER TABLE DROP COLUMN drop whole-row referenced object
Date
Msg-id CACJufxFeYySYRFOvUcvXeb6h0Q7FA6AAhn+xA+AaSbXU9c98Zw@mail.gmail.com
Whole thread
In response to Re: let ALTER TABLE DROP COLUMN drop whole-row referenced object  (jian he <jian.universality@gmail.com>)
Responses Re: let ALTER TABLE DROP COLUMN drop whole-row referenced object
List pgsql-hackers
On Mon, May 25, 2026 at 2:43 PM jian he <jian.universality@gmail.com> wrote:
>
> Overall, the attached v9 doesn't include any major changes.
> It just contains some refactoring to make the coding style consistent with [1].
>

Hi.
Rebase because of
https://git.postgresql.org/cgit/postgresql.git/commit/?id=a4639d64e2199885f8e995395b6fe874cb7228bf
I also simplified the code a little bit, polished the comments, and
merged 3 patches into one, no major changes.

Below is the commit message:
Subject: [PATCH v14 1/1] Whole-row fixes for DROP COLUMN, SET COLUMN DATA TYPE

ALTER TABLE DROP COLUMN should remove indexes or constraints contain whole-row
references, just like non-whole-row column.

ALTER TABLE DROP COLUMN should fail if a trigger WHEN clause or row-level
security policy contains a whole-row reference. To do this, record a dependency
between the relation and the trigger or policy in
RememberWholeRowDependentForRebuilding; performMultipleDeletions then handles
the deletion checks.

ALTER COLUMN SET DATA TYPE fundamentally changes the table’s record type; At
present, we cannot compare records that contain columns of dissimilar types, see
function record_eq.  As a result, ALTER COLUMN SET DATA TYPE does not work for
whole-row reference objects (such as constraints and indexes), and must
therefore raise an error.

discussion: https://postgr.es/m/CACJufxGA6KVQy7DbHGLVw9s9KKmpGyZt5ME6C7kEfjDpr2wZCw@mail.gmail.com
commitfest: https://commitfest.postgresql.org/patch/6055
----------------------------------------------------------------------------------------------



--
jian
https://www.enterprisedb.com/

Attachment

pgsql-hackers by date:

Previous
From: shveta malik
Date:
Subject: Re: sequencesync worker race with REFRESH SEQUENCES
Next
From: Sami Imseih
Date:
Subject: Re: [Proposal] Adding callback support for custom statistics kinds