Re: let ALTER TABLE DROP COLUMN drop whole-row referenced object

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: lakshmi <lakshmigcdac(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, 金 <jinbinge(at)126(dot)com>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Subject: Re: let ALTER TABLE DROP COLUMN drop whole-row referenced object
Date: 2026-07-14 04:15:43
Message-ID: CACJufxFeYySYRFOvUcvXeb6h0Q7FA6AAhn+xA+AaSbXU9c98Zw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, May 25, 2026 at 2:43 PM jian he <jian(dot)universality(at)gmail(dot)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 Content-Type Size
v14-0001-Whole-row-fixes-for-DROP-COLUMN-SET-COLUMN-DATA-TYPE.patch text/x-patch 33.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2026-07-14 04:30:29 Re: [Proposal] Adding callback support for custom statistics kinds
Previous Message shveta malik 2026-07-14 03:32:13 Re: sequencesync worker race with REFRESH SEQUENCES