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:31:32Z
Lists: pgsql-hackers
I wrote: > Peter Eisentraut <peter@eisentraut.org> writes: >> 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. Oh: looking closer, the reason is that ATSimpleRecursion already located all the direct and indirect child tables and will call ATPrepCmd on each one. Therefore it's correct that ATPrepCmd should be told recurse = false; we do not want it to look for child tables. You could argue that passing recursing = true for each rel is bogus, and we should arrange to pass recursing = false for the original table and true only for whatever children we found. But I'm not sure that anything would care. That doesn't sound like it would help for the current problem, anyway. If it actually matters for DROP EXPRESSION, then the answer is probably "we can't use ATSimpleRecursion for DROP EXPRESSION". ATSimpleRecursion is meant for cases where each table can be processed independently, regardless of its position in the hierarchy. regards, tom lane