Re: BUG #19632: RULE rewriting crashes with XX000 when RETURNING old/new references a system column

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Cc: hackerzheng666(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19632: RULE rewriting crashes with XX000 when RETURNING old/new references a system column
Date: 2026-08-20 08:29:36
Message-ID: CAN4CZFNJrt--xPEuQgFxg3TtNFPAifc9SbQbP=K_8fUUYDnh9Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> FWIW, I tend to see rules as relics of the past. Triggers are for one
> more useful in modern systems, so I cannot really get excited with an
> extension of the grammar to support an edge case that has, as far as I
> know, never worked since we support RETURNING.

Right, I thought you can't implement soft delete with triggers but of
course you can. Except that RETURNING doesn't work at all in that
case, unless I make it a delete+insert or also introduce a helper
view, but even with the view I can only get out the old xmin, not the
new.
Anyway, that's a different issue.

On Wed, 19 Aug 2026, Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com> wrote:
> It seems all 19629 to 19632 bug is the same line of issue, and there
> might be more such cases where ERRCODE is not added
> across the tree. We can accumulate all such cases and do a single
> commit for them.

I agree that it would be better to handle all this in this commit, but
the patch you shared in [1] seems to be missing this change (the
commit message also only references ugs up to 31). And I think we
should also fix the error message for the FOR PORTION[2] issue.

[1] https://www.postgresql.org/message-id/CAJTYsWWpwHsvzKp0JPvGbWttXrOafMCtmGBBQs6bhCKn88fgug%40mail.gmail.com
[2] https://www.postgresql.org/message-id/CAN4CZFPsGAs3x5oBi5YiUyFdJgJrxfp%3DHi3xscq_Y-HLMCs1kQ%40mail.gmail.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Ayush Tiwari 2026-08-20 08:58:17 Re: BUG #19632: RULE rewriting crashes with XX000 when RETURNING old/new references a system column
Previous Message jian he 2026-08-20 07:41:41 Re: MERGE/SPLIT PARTITIONS issues/questions