Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Kirill Reshke <reshkekirill@gmail.com>,
jian he <jian.universality@gmail.com>,
PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-11-04T18:16:05Z
Lists: 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