Re: Getting sequence-generated IDs from multiple row insert - Mailing list pgsql-general

From Andrew Sullivan
Subject Re: Getting sequence-generated IDs from multiple row insert
Date
Msg-id 20140331211041.GG54796@crankycanuck.ca
Whole thread Raw
In response to Re: Getting sequence-generated IDs from multiple row insert  (David Johnston <polobo@yahoo.com>)
List pgsql-general
On Mon, Mar 31, 2014 at 01:34:04PM -0700, David Johnston wrote:
>
> If order is an implicit property of the source data then you need to
> explicitly encode that order during (or before) import.

Sure, but the problem the OP had I thought was that the RETURNING
clause doesn't guarantee that the rows coming back are in the order
they were inserted.  This is just a SQL thing.  (I guess you could
ORDER BY the RETURNING clause, right?)

> There are numerous
> ways to implement such but except for extremely simple cases PostgreSQL will
> not do the appropriate thing automatically in the face of concurrency.

It _is_ doing the appropriate thing, though: this is SQL.  The rows
aren't ordered unless you tell them to be.

A

--
Andrew Sullivan
ajs@crankycanuck.ca


pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Why does "checkpointer" is consumig ~1.2Gb of RAM?
Next
From: Tom Lane
Date:
Subject: Re: Wanted: ALTER TRIGGER ... OWNED BY EXTENSION