Re: JDBC driver - is "getGeneratedKeys()" guaranteed to return the ids in the same order a batch insert was made?

Поиск
Список
Период
Сортировка
От electrotype
Тема Re: JDBC driver - is "getGeneratedKeys()" guaranteed to return the ids in the same order a batch insert was made?
Дата
Msg-id c41792c8-7a94-2736-0316-dba3d1e7c885@gmail.com
обсуждение исходный текст
Ответ на Re: JDBC driver - is "getGeneratedKeys()" guaranteed to return the ids in the same order a batch insert was made?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: JDBC driver - is "getGeneratedKeys()" guaranteed to return the ids in the same order a batch insert was made?
Список pgsql-general
Agreed.

However, this isn't really the purview of JDBC - I'm doubting it does anything that would cause the order to be different than what is received, and the batch items are sent and results processed sequentially.

The main question is whether any batch items are inserting multiple records themselves - i.e., RETURNING * is producing multiple results.  Whatever order RETURNING * produces is what the driver will capture - but it isn't responsible for guaranteeing that the order of multiple inserted records going in matches what comes out.  PostgreSQL needs to make that claim.  I don't see where it does (i've sent an email to see if adding such a claim to the documentation is proper).  Done manually one can always do "WITH insert returning SELECT ORDER BY", but it doesn't seem workable for the driver to try and do that when adding the returning clause, which I presume is what is in scope here.

David J.

Thank you, it's appreciated! I'm sure this clarification would help other developers too.

В списке pgsql-general по дате отправления:

Предыдущее
От: Paul Förster
Дата:
Сообщение: Re: User input to queries
Следующее
От: avi Singh
Дата:
Сообщение: sum of numeric column