Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy
Date
Msg-id 650085.1762280165@sss.pgh.pa.us
Whole thread Raw
In response to Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy  (Peter Eisentraut <peter@eisentraut.org>)
Responses Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy
List pgsql-hackers
Peter Eisentraut <peter@eisentraut.org> writes:
> I find that tablecmds.c uses these two arguments in not entirely 
> consistent ways.

> I would have expected that if you write a command that is supposed to 
> recurse (no ONLY) and you are some levels down into the recursing, then 
> recursing=true, of course, but shouldn't recurse=true as well, to 
> reflect the command that was written?

I think the intent was that

(1) recurse = true is an instruction to recurse down to any child
tables that may exist;

(2) recursing = true is a status flag saying we're already not at
the topmost parent table.

There is no situation where we'd recurse but only for a limited
number of levels, so I can't believe that recurse = false with
recursing = true is a valid state.

> But in ATPrepDropExpression(), when you're recursing, then recurse is 
> always false.  That is hardcoded in the ATPrepCmd() call in 
> ATSimpleRecursion().  Does that make sense?

Seems wrong, but I didn't trace through the code.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy
Next
From: Jacob Champion
Date:
Subject: Re: Intention to start an [oauth] "working group"