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

From David G. Johnston
Subject Re: CommandStatus from insert returning when using a portal.
Date
Msg-id CAKFQuwYioZVjVo-j57AWRScG6ics9E837ESGcksDYRJcP4wwXQ@mail.gmail.com
Whole thread Raw
In response to Re: CommandStatus from insert returning when using a portal.  (Chapman Flack <chap@anastigmatix.net>)
Responses Re: CommandStatus from insert returning when using a portal.
List pgsql-hackers
On Fri, Jul 14, 2023 at 3:12 PM Chapman Flack <chap@anastigmatix.net> wrote:
If someone really does want to do a huge INSERT and get the generated
values back in increments, it might be clearer to write an explicit
INSERT RETURNING and issue it with executeQuery, where everything will
work as expected.


For PostgreSQL this is even moreso (i.e, huge means count > 1) since the order of rows in the returning clause is not promised to be related to the order of the rows as seen in the supplied insert command.  A manual insert returning should ask for not only any auto-generated column but also the set of columns that provide the unique natural key.

David J.

pgsql-hackers by date:

Previous
From: Jacob Champion
Date:
Subject: Re: pg_dump needs SELECT privileges on irrelevant extension table
Next
From: Chapman Flack
Date:
Subject: Re: CommandStatus from insert returning when using a portal.