Re: CommandStatus from insert returning when using a portal. - Mailing list pgsql-hackers

From Dave Cramer
Subject Re: CommandStatus from insert returning when using a portal.
Date
Msg-id CADK3HH+gDcwgGO6N=8MuGB8rtZ3MruQY1rVFJT+yE27H6pnLmQ@mail.gmail.com
Whole thread Raw
In response to Re: CommandStatus from insert returning when using a portal.  (chap@anastigmatix.net)
Responses Re: CommandStatus from insert returning when using a portal.
Re: CommandStatus from insert returning when using a portal.
List pgsql-hackers


On Wed, 12 Jul 2023 at 20:00, <chap@anastigmatix.net> 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

Huh ... just how *is* PreparedStatement.execute() supposed
to behave when the statement is an INSERT RETURNING?

It's really executeUpdate which is supposed to return the number of rows updated.
Without a cursor it returns right away as all of the results are returned by the server. However with cursor you have to wait until you fetch the rows before you can get the CommandComplete message which btw is wrong as it returns INSERT 0 0 instead of INSERT 2 0

Dave

pgsql-hackers by date:

Previous
From: Matheus Alcantara
Date:
Subject: Duplicated LLVMJitHandle->lljit assignment?
Next
From: Masahiro Ikeda
Date:
Subject: Re: Support to define custom wait events for extensions