public inbox for [email protected]  
help / color / mirror / Atom feed
BUG #19516: Mixup of OLD/NEW with RETURNING when parenthesized
2+ messages / 2 participants
[nested] [flat]

* BUG #19516: Mixup of OLD/NEW with RETURNING when parenthesized
@ 2026-06-10 10:09 PG Bug reporting form <[email protected]>
  2026-06-10 10:50 ` Re: BUG #19516: Mixup of OLD/NEW with RETURNING when parenthesized Marko Grujic <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2026-06-10 10:09 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]

The following bug has been logged on the website:

Bug reference:      19516
Logged by:          Marko Grujic
Email address:      [email protected]
PostgreSQL version: 18.4
Operating system:   MacOS, Debian
Description:        

Hi, reporting a basic bug which involves a RETURNING clause on DML with
parenthesized OLD/NEW.

Effectively, the (parenthesized) row reference isn't being honored, and
instead the default behavior is applied.

Seeing this on tip of master as well (19beta1).

postgres=# create table t(a int, b text);
CREATE TABLE
postgres=# insert into t values (1, 'one') returning (old).b, old.b,
(new).b, new.b;
  b  | b |  b  |  b
-----+---+-----+-----
 one |   | one | one
(1 row)

INSERT 0 1
postgres=# update t set b = '1' where a = 1 returning (old).b, old.b,
(new).b, new.b;
 b |  b  | b | b
---+-----+---+---
 1 | one | 1 | 1
(1 row)

UPDATE 1
postgres=# delete from t where a = 1 returning (old).b, old.b, (new).b,
new.b;
 b | b | b | b
---+---+---+---
 1 | 1 | 1 |
(1 row)

DELETE 1
postgres=# select version();
                                                      version
--------------------------------------------------------------------------------------------------------------------
 PostgreSQL 18.4 (Debian 18.4-1.pgdg13+1) on x86_64-pc-linux-gnu, compiled
by gcc (Debian 14.2.0-19) 14.2.0, 64-bit
(1 row)







^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #19516: Mixup of OLD/NEW with RETURNING when parenthesized
  2026-06-10 10:09 BUG #19516: Mixup of OLD/NEW with RETURNING when parenthesized PG Bug reporting form <[email protected]>
@ 2026-06-10 10:50 ` Marko Grujic <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Marko Grujic @ 2026-06-10 10:50 UTC (permalink / raw)
  To: [email protected]

Proposed patch:
https://www.postgresql.org/message-id/CAOvwyF2cO_5mAt%3Dw%3Dy-dFnaG5UkZ%2B3H8nSDoKF_iuWZHsU2ARg%40ma...

On Wed, Jun 10, 2026 at 12:10 PM PG Bug reporting form <
[email protected]> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      19516
> Logged by:          Marko Grujic
> Email address:      [email protected]
> PostgreSQL version: 18.4
> Operating system:   MacOS, Debian
> Description:
>
> Hi, reporting a basic bug which involves a RETURNING clause on DML with
> parenthesized OLD/NEW.
>
> Effectively, the (parenthesized) row reference isn't being honored, and
> instead the default behavior is applied.
>
> Seeing this on tip of master as well (19beta1).
>
> postgres=# create table t(a int, b text);
> CREATE TABLE
> postgres=# insert into t values (1, 'one') returning (old).b, old.b,
> (new).b, new.b;
>   b  | b |  b  |  b
> -----+---+-----+-----
>  one |   | one | one
> (1 row)
>
> INSERT 0 1
> postgres=# update t set b = '1' where a = 1 returning (old).b, old.b,
> (new).b, new.b;
>  b |  b  | b | b
> ---+-----+---+---
>  1 | one | 1 | 1
> (1 row)
>
> UPDATE 1
> postgres=# delete from t where a = 1 returning (old).b, old.b, (new).b,
> new.b;
>  b | b | b | b
> ---+---+---+---
>  1 | 1 | 1 |
> (1 row)
>
> DELETE 1
> postgres=# select version();
>                                                       version
>
> --------------------------------------------------------------------------------------------------------------------
>  PostgreSQL 18.4 (Debian 18.4-1.pgdg13+1) on x86_64-pc-linux-gnu, compiled
> by gcc (Debian 14.2.0-19) 14.2.0, 64-bit
> (1 row)
>
>
>


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-06-10 10:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-06-10 10:09 BUG #19516: Mixup of OLD/NEW with RETURNING when parenthesized PG Bug reporting form <[email protected]>
2026-06-10 10:50 ` Marko Grujic <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox