Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows
Date
Msg-id 19445.1350482182@sss.pgh.pa.us
Whole thread Raw
In response to [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows  ("P. Christeas" <xrg@linux.gr>)
Responses Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows  ("P. Christeas" <xrg@linux.gr>)
Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows  (Abhijit Menon-Sen <ams@2ndQuadrant.com>)
Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows  (Christopher Browne <cbbrowne@gmail.com>)
List pgsql-hackers
"P. Christeas" <xrg@linux.gr> writes:
> It has been a fact that the RETURNING clause on an INSERT will return
> multiple rows with the same order as multiple VALUES have been fed.

> eg: INSERT INTO tbl1(code) VALUES ('abc'), ('def'), ('agh')
>            RETURNING id, code;

> is expected to yield:
>    id | code
>   -----------
>     1 | abc
>     2 | def
>     3 | agh

> Clarify that in the documentation, and also write a test case that will
> prevent us from breaking the rule in the future.

I don't believe this is a good idea in the slightest.  Yeah, the current
implementation happens to act like that, but there is no reason that we
should make it guaranteed behavior.  Nor is a regression test case going
to stop someone from changing it, anyway.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows
Next
From: Peter Geoghegan
Date:
Subject: Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows