Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy
| От | jian he |
|---|---|
| Тема | Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy |
| Дата | |
| Msg-id | CACJufxG=Sr9sLngB0bKS6VHqB9K7yD6+JUyU1knncXwfiyBGJQ@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy (Kirill Reshke <reshkekirill@gmail.com>) |
| Список | pgsql-hackers |
On Tue, Dec 30, 2025 at 4:56 AM Kirill Reshke <reshkekirill@gmail.com> wrote:
>
> Hi!
> I did take another look at this thread. I agree this "recurse and
> recursing" logic is a little confusing.
> Anyway, are you saying that v3 from this thread is a fix you are OK with?
>
Yes.
Maybe we can do something in ATSimpleRecursion.
but ATSimpleRecursion is very generic. adding some ad-hoc code for
AT_DropExpression seems not ideal.
In ATPrepDropExpression
```
if (!recurse && !recursing &&
find_inheritance_children(RelationGetRelid(rel), lockmode))
ereport(ERROR,
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("ALTER TABLE / DROP EXPRESSION must be applied
to child tables too"),
errhint("Do not specify the ONLY keyword."));
```
is correct, i think.
If ONLY is not specified:
For child relations (see ATSimpleRecursion), the code invokes
ATPrepDropExpression(rel, cmd, false, true, lockmode);
For the parent relation, it invokes
ATPrepDropExpression(rel, cmd, true, false, lockmode);
If ONLY is specified:
The ATSimpleRecursion logic is entirely skipped.
ATPrepDropExpression is invoked exactly once as
ATPrepDropExpression(rel, cmd, false, false, lockmode);
--
jian
https://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: