Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows

From: "P(dot) Christeas" <xrg(at)linux(dot)gr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows
Date: 2012-10-17 15:16:42
Message-ID: 201210171816.42494.xrg@linux.gr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wednesday 17 October 2012, you wrote:
> "P. Christeas" <xrg(at)linux(dot)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!

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2012-10-17 16:07:52 Re: September 2012 commitfest
Previous Message Alvaro Herrera 2012-10-17 15:04:37 Re: Reduce palloc's in numeric operations.