| From: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
|---|---|
| To: | 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-19 10:56:19 |
| Message-ID: | CAN4CZFOTLqGioJfRrQhCq0c2j0fcoG7FA4vMOOwc_Bg1fXheVQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hello
This also seems reproducible on PG 18.
I think there could be some corner-cases where supporting this would
be useful, for example SQLAlchemy supports locking via xmin[1], and a
soft delete rule (ON DELETE DO INSTEAD UPDATE ... SET deleted=true)
could break that.
We could support something like this with a new syntax perhaps?
CREATE RULE ... DO INSTEAD ... RETURNING * WITH SYSTEM COLUMNS (xmin
AS t.xmin ....);
However, that would be a new feature. The safe and easy choice (at
least for 18/19) seems to be reporting a proper error message.
The attached patch improves the issue by adding that error message.
[1] https://docs.sqlalchemy.org/en/21/orm/versioning.html#server-side-version-counters
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Fix-rule-rewriting-failure-for-system-columns-in-.patch | application/octet-stream | 4.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jochen Bandhauer | 2026-08-19 11:03:27 | repack with verbose output: not showing the number of removable row versions when using USING INDEX or CONCURRENTLY option |
| Previous Message | Ayush Tiwari | 2026-08-19 10:46:23 | Re: BUG #19631: currtid2() on a view with GROUP BY ctid crashes with XX000 |