Re: CommandStatus from insert returning when using a portal.

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: CommandStatus from insert returning when using a portal.
Дата
Msg-id CADK3HHJPfbwn3-dTDDxCd4qQXHCt7KH4yuuxV37F6c-FkDBWgA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: CommandStatus from insert returning when using a portal.  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: CommandStatus from insert returning when using a portal.
Re: CommandStatus from insert returning when using a portal.
Список pgsql-hackers


On Wed, 12 Jul 2023 at 17:49, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Dave Cramer <davecramer@gmail.com> writes:
> Obviously I am biased by the JDBC API which would like to have
> PreparedStatement.execute() return the number of rows inserted
> without having to wait to read all of the rows returned

Umm ... you do realize that we return the rows on-the-fly?
I do realize that. 
The server does not know how many rows got inserted/returned
Well I haven't looked at the code, but it seems unintuitive that adding the returning clause changes the semantics of insert. 

until it's run the query to completion, at which point all
the data has already been sent to the client.  There isn't
any way to return the rowcount before the data, and it wouldn't
be some trivial protocol adjustment to make that work differently.
(What it *would* be is expensive, because we'd have to store
those rows somewhere.)
I wasn't asking for that, I just want the number of rows inserted.

Thanks,

Dave

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: CommandStatus from insert returning when using a portal.
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: CommandStatus from insert returning when using a portal.