Order of generated keys during inserts

Andrei Tsibets <[email protected]> Wed, 16 Oct 2019 11:14:24 +0300
Newsgroups gmane.comp.db.postgresql.jdbc
Message-ID <[email protected]>
--Apple-Mail=_540D9D64-6246-496A-B912-553777384412
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

Hello,

I=E2=80=99m 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?

PostgreSQL 11
JDBC driver 42.2.5

Thank you,
Andrei=

--Apple-Mail=_540D9D64-6246-496A-B912-553777384412
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
-webkit-line-break: after-white-space;" class=3D"">Hello,<div =
class=3D""><br class=3D""></div><div class=3D"">I=E2=80=99m doing =
multiple inserts into PostgreSQL using&nbsp;<i =
class=3D"">executeBatch</i>, and then retrieving generated primary keys =
via <i class=3D"">getGeneratedKeys()</i>.</div><div class=3D"">The =
question is: is it save to match inserts with retuned keys by order? Is =
it guaranteed that generated keys are ordered according</div>to the =
order in which commands were added to the batch?<div class=3D""><br =
class=3D""></div><div class=3D"">PostgreSQL 11</div><div class=3D"">JDBC =
driver 42.2.5</div><div class=3D""><br class=3D""></div><div =
class=3D"">Thank you,</div><div class=3D"">Andrei</div></body></html>=

--Apple-Mail=_540D9D64-6246-496A-B912-553777384412--