Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy

2025-11-10 Thread jian he
On Wed, Nov 5, 2025 at 2:31 AM Tom Lane wrote: > > > 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

Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy

2025-11-04 Thread Tom Lane
I wrote: > Peter Eisentraut 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

Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy

2025-11-04 Thread Tom Lane
Peter Eisentraut 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 shou

Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy

2025-11-04 Thread Peter Eisentraut
On 25.08.25 15:04, Kirill Reshke wrote: So we need to detect if the user did ALTER TABLE or ALTER TABLE ONLY. And we have two parameters passed to ATPrepDropExpression: "recurse" and "recursing". First is about whether the user specified ONLY option and second is about if we are recursing in our

Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy

2025-10-22 Thread BharatDB
Hi all, I tried to fix a bug in PostgreSQL where ALTER TABLE ... DROP EXPRESSION fails on multi-level inheritance hierarchies. Bug: When a parent table has a generated column and child/grandchild tables inherit from it, executing: ALTER TABLE parent ALTER COLUMN d DROP EXPRESSION; ERROR: ALTER

Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy

2025-08-27 Thread Kirill Reshke
On Thu, 28 Aug 2025 at 08:35, jian he wrote: > > That means, we don't need to change the ATPrepDropExpression function > argument for now? Sure. V3 with this attached, and I think we can move cf entry to RFC -- Best regards, Kirill Reshke v3-0001-Fix-ALTER-TABLE-DROP-EXPRESSION-with-inheritan

Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy

2025-08-27 Thread jian he
On Mon, Aug 25, 2025 at 9:04 PM Kirill Reshke wrote: > > Hi! > > On Sun, 24 Aug 2025 at 14:05, jian he wrote: > > > > hi. > > > > --this ALTER COLUMN DROP EXPRESSION work as expected > > DROP TABLE IF EXISTS parent cascade; > > CREATE TABLE parent (a int, d INT GENERATED ALWAYS AS (11) STORED);

Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy

2025-08-25 Thread Kirill Reshke
Looks like no CF entry for this thread. CF entry [0] created. [0] https://commitfest.postgresql.org/patch/5992/ -- Best regards, Kirill Reshke

Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy

2025-08-25 Thread Kirill Reshke
Hi! On Sun, 24 Aug 2025 at 14:05, jian he wrote: > > hi. > > --this ALTER COLUMN DROP EXPRESSION work as expected > DROP TABLE IF EXISTS parent cascade; > CREATE TABLE parent (a int, d INT GENERATED ALWAYS AS (11) STORED); > CREATE TABLE child () INHERITS (parent); > ALTER TABLE parent ALTER COL