Re: Order of generated keys during inserts

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Andrei Tsibets <andreit(at)geomotiv(dot)com>
Cc: pgsql-jdbc(at)lists(dot)postgresql(dot)org
Subject: Re: Order of generated keys during inserts
Date: 2019-10-18 03:53:56
Message-ID: CADK3HH+=3wD5qu86yYKevpfm5BTvuxypd_GW9cATsRfC_1=gNg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Wed, 16 Oct 2019 at 20:26, Andrei Tsibets <andreit(at)geomotiv(dot)com> wrote:

> Hello,
>
> I’m doing multiple inserts into PostgreSQL using *executeBatch*, and then
> retrieving generated primary keys via *getGeneratedKeys()*.
> The question is: is it save to match inserts with retuned keys by order?
> Is it guaranteed that generated keys are ordered according
> to the order in which commands were added to the batch?
>

They should be but we make no such guarantee.

Dave Cramer

davec(at)postgresintl(dot)com
www.postgresintl.com

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Árpád Magosányi 2019-10-23 22:29:53 [pgjdbc/pgjdbc] 635cc8: fix documentation on generating the pk8 key. close...
Previous Message Andrei Tsibets 2019-10-16 08:14:24 Order of generated keys during inserts