[PATCH v1] [BUG #19516] Skip whole-row projection shortcut for OLD/NEW returning type

From: Marko Grujic <marko(dot)grujic(at)enterprisedb(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Marko Grujic <markoog(at)gmail(dot)com>
Subject: [PATCH v1] [BUG #19516] Skip whole-row projection shortcut for OLD/NEW returning type
Date: 2026-06-10 10:48:20
Message-ID: CAOvwyF2cO_5mAt=w=y-dFnaG5UkZ+3H8nSDoKF_iuWZHsU2ARg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, submitting a patch for bug #19516 (held in moderation queue atm).

Looks like the root cause is that the shortcut taken
in ParseComplexProjection
loses the `varreturningtype` flag, causing it to default to
`VAR_RETURNING_DEFAULT`.

Consequently, the default RETURNING behavior is applied, which is strictly
wrong
when a user typed (old).col on INSERT/UPDATE or (new).col on DELETE.

To fix this simply skip the shortcut when varreturningtype is set to
VAR_RETURNING_OLD/VAR_RETURNING_NEW.

Also added tests that exercise this.

Thanks,
Marko

Attachment Content-Type Size
0001-Skip-whole-row-projection-shortcut-for-OLD-NEW-retur.patch application/octet-stream 4.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2026-06-10 10:50:18 Re: GetBufferDescriptor() being called for local buffers from MarkBufferDirtyHint()
Previous Message jian he 2026-06-10 10:48:01 Re: Row pattern recognition