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

From P. Christeas
Subject Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows
Date
Msg-id 201210171816.42494.xrg@linux.gr
Whole thread Raw
In response to Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wednesday 17 October 2012, you wrote:
> "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.
>
> 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.  

That's my point, to push you to decide on that "feature" and clarify it in the 
documentation.

So far, it's very tempting for me to use this behavior, since I can avoid 
multiple INSERTs (=save bandwidth) and also the burden of figuring out which of 
the returned ids associates to which inserted row.

Having a discussion (or argument or a vote) like this, I think, is useful.


FYI, there is also a stack overflow question on this:
http://stackoverflow.com/questions/5439293/is-insert-returning-guaranteed-to-
return-things-in-the-right-order

-- 
Say NO to spam and viruses. Stop using Microsoft Windows!



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Identity projection
Next
From: Alvaro Herrera
Date:
Subject: Re: September 2012 commitfest