Thread: Order of generated keys during inserts
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?PostgreSQL 11
JDBC driver 42.2.5
Thank you,
Andrei
On Wed, 16 Oct 2019 at 20:26, Andrei Tsibets <andreit@geomotiv.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 accordingto the order in which commands were added to the batch?
They should be but we make no such guarantee.