Re: Guidance on INSERT RETURNING order

From: Federico <cfederico87(at)gmail(dot)com>
To: Thorsten Glaser <tg(at)evolvis(dot)org>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Guidance on INSERT RETURNING order
Date: 2023-04-11 21:30:52
Message-ID: CAN19dyfhqBhsiDDUyQCAyjm_OC=SMo+wGrE7W84RiJOvAPCr7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 11 Apr 2023 at 23:22, Thorsten Glaser <tg(at)evolvis(dot)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 :-)
>
>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Federico 2023-04-11 21:38:20 Re: Guidance on INSERT RETURNING order
Previous Message Rob Sargent 2023-04-11 21:17:36 Re: Guidance on INSERT RETURNING order