Re: CommandStatus from insert returning when using a portal.

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: CommandStatus from insert returning when using a portal.
Дата
Msg-id CAKFQuwa97UN65V0YME1Wcz3-szFDENj-zpduQA=XcCPV0PMG7Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: CommandStatus from insert returning when using a portal.  (chap@anastigmatix.net)
Ответы Re: CommandStatus from insert returning when using a portal.
Список pgsql-hackers
On Fri, Jul 14, 2023 at 11:34 AM <chap@anastigmatix.net> wrote:
On 2023-07-12 21:30, David G. Johnston wrote:
> Right, and executeUpdate is the wrong API method to use, in the
> PostgreSQL
> world, when executing insert/update/delete with the non-SQL-standard
> returning clause. ... ISTM that you are trying to make user-error less
> painful.

In Dave's Java reproducer, no user-error has been made, because the user
supplied a plain INSERT with the RETURN_GENERATED_KEYS option, and the
RETURNING clause has been added by the JDBC driver. So the user expects
executeUpdate to be the right method, and return the row count, and
getGeneratedKeys() to then return the rows.


That makes more sense, though I don't understand how the original desire of having the count appear before the actual rows would materially benefit that feature.

I agree that the documented contract of the insert command tag says it reports the size of the entire tuple store maintained by the server during the transaction instead of just the most recent count on subsequent fetches.

David J.

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

Предыдущее
От: Daniel Gustafsson
Дата:
Сообщение: Re: sslinfo extension - add notbefore and notafter timestamps
Следующее
От: Erik Rijkers
Дата:
Сообщение: Re: PG 16 draft release notes ready