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

From P. Christeas
Subject Re: Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows
Date
Msg-id 201210211940.33857.xrg@linux.gr
Whole thread Raw
In response to Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows  (Abhijit Menon-Sen <ams@2ndQuadrant.com>)
List pgsql-hackers
On Sunday 21 October 2012, Abhijit Menon-Sen wrote:
> At 2012-10-21 11:49:26 -0400, cbbrowne@gmail.com wrote:
> > If there is a natural sequence (e.g. - a value assigned by nextval()),
> > that offers a natural place to apply the usual order-imposing ORDER BY
> > that we are expected to use elsewhere.
>
> Note: "INSERT … RETURNING" doesn't accept an ORDER BY clause.

Exactly. And IMHO it should never have.

The real trouble is when you insert some arbitrary values, which have no
implicit order or primary key /before/ the insert will assign them one. Then,
you need to map them to the SERIAL they got.

Or else, you can't use the multi-row INSERT and must just do many INSERTs.





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



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows
Next
From: Tom Lane
Date:
Subject: Re: Successor of MD5 authentication, let's use SCRAM