On Tue, Dec 30, 2025 at 4:56 AM Kirill Reshke <[email protected]> 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


Reply via email to