Re: Guidance on INSERT RETURNING order - Mailing list pgsql-general

From Federico
Subject Re: Guidance on INSERT RETURNING order
Date
Msg-id CAN19dyfhqBhsiDDUyQCAyjm_OC=SMo+wGrE7W84RiJOvAPCr7g@mail.gmail.com
Whole thread Raw
In response to Re: Guidance on INSERT RETURNING order  (Thorsten Glaser <tg@evolvis.org>)
Responses Re: Guidance on INSERT RETURNING order
List pgsql-general
On Tue, 11 Apr 2023 at 23:22, Thorsten Glaser <tg@evolvis.org> wrote:
>
> On Tue, 11 Apr 2023, Federico wrote:
>
> >Of course sorting the returned ids is only viable when using a serial
>
> Yes, which is why I pointed out it doesn’t have to be.
>
> >or identity column, that's why in the general case I've mentioned the
> >insert with sentinel column
>
> But it was pointed out that that’s not guaranteed either, unless you add
> that sentinel column to the table itself…

I was under the impression that when using INSERT SELECT ORDER BY the sequence
ids were generated using the select order.
That has been mentioned in multiple other previous messages, like
https://www.postgresql.org/message-id/29386.1528813619%40sss.pgh.pa.us

The above does not cover all cases, but in practice serial or identity
are very common,
so it would be nice if at least in these cases a sentinel is not needed

Thanks,
  Federico

> bye,
> //mirabilos
> --
> 15:41⎜<Lo-lan-do:#fusionforge> Somebody write a testsuite for helloworld :-)
>
>
>
>



pgsql-general by date:

Previous
From: Rob Sargent
Date:
Subject: Re: Guidance on INSERT RETURNING order
Next
From: Federico
Date:
Subject: Re: Guidance on INSERT RETURNING order