On Wed, Aug 19, 2026 at 11:56:19AM +0100, Zsolt Parragi wrote:
> 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?
Target list replacements have never coped with negative attnums in the
rewrite paths, as far as I can see.
> CREATE RULE ... DO INSTEAD ... RETURNING * WITH SYSTEM COLUMNS (xmin
> AS t.xmin ....);
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.
> 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.
An error message sounds like a protection good enough for me. Whether
someone is motivated to support such cases is a different question,
but IMO we may be closer with removing support for rules than trying
to extend it.
--
Michael