| From: | jian he <jian(dot)universality(at)gmail(dot)com> |
|---|---|
| To: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
| Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: let ALTER TABLE DROP COLUMN drop whole-row referenced object |
| Date: | 2025-12-23 01:49:26 |
| Message-ID: | CACJufxEApboeVKP4jdYOkikOij22HrHWnuSb=u-cJ7AHMBcOxA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
I have consolidated the work into two patches.
0001 handles indexes and CHECK constraints that contain whole-row references.
0002 handles policies that contain whole-row references.
The difference is that, for policy objects, we cannot use pull_varattnos to find
whole-row references, since we need recurse to Sublink node, Also, a policy’s
whole-row reference may point to an arbitrary relation, while index, check
constraint can only reference the relation it is associated with.
so the previous v5-0003 scans pg_policy.polrelid to find out whether it's safe
to drop one relation is wrong, we should use pg_depend.
summary:
For objects (indexes, constraints, policies) that contain whole-row references:
ALTER TABLE DROP COLUMN will drop these objects too.
ALTER COLUMN SET DATA TYPE will error out, saying that the data type cannot be
changed because whole-row–dependent objects exist.
| Attachment | Content-Type | Size |
|---|---|---|
| v6-0001-fix-DDL-wholerow-referenced-constraints-and-indexes.patch | text/x-patch | 16.4 KB |
| v6-0002-disallow-ALTER-TABLE-ALTER-COLUMN-when-wholerow-referenced-policy.patch | text/x-patch | 14.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2025-12-23 02:59:45 | Re: Switch buffile.c/h to use pgoff_t |
| Previous Message | Chao Li | 2025-12-23 01:41:41 | Re: [PATCH] Add memory usage reporting to VACUUM VERBOSE |