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 CACJufxEApboeVKP4jdYOkikOij22HrHWnuSb=u-cJ7AHMBcOxA@mail.gmail.com
Whole thread Raw
In response to Re: let ALTER TABLE DROP COLUMN drop whole-row referenced object  (jian he <jian.universality@gmail.com>)
List 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.


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

Attachment

pgsql-hackers by date:

Previous
From: Chao Li
Date:
Subject: Re: [PATCH] Add memory usage reporting to VACUUM VERBOSE
Next
From: Chao Li
Date:
Subject: Re: Switch buffile.c/h to use pgoff_t