Re: Guidance on INSERT RETURNING order

Поиск
Список
Период
Сортировка
От Federico
Тема Re: Guidance on INSERT RETURNING order
Дата
Msg-id CAN19dydW+f2iQ4b0XrMWeoJBNMQMosWjbLc3uthZ=aG+EsuyCA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Guidance on INSERT RETURNING order  (Thorsten Glaser <tg@evolvis.org>)
Ответы Re: Guidance on INSERT RETURNING order  (Thorsten Glaser <tg@evolvis.org>)
Re: Guidance on INSERT RETURNING order  ("Mike Bayer" <mike_mp@zzzcomputing.com>)
Список pgsql-general
On Tue, 11 Apr 2023 at 22:59, Thorsten Glaser <tg@evolvis.org> wrote:
>
> On Tue, 11 Apr 2023, Federico wrote:
>
> >The problem here is not having the auto increment id in a particular
>
> The id might not even be auto-increment but UUID or something…
> (I am surprised you would even try to insert multiple rows at once.)

Well the documentation makes no mention of any limitation on returning
and the observed behaviour has consistently been that returning is in
values order.
Again, that was SQLAlchemy's fault for assuming this (but the docs
surely did not help).

Also re-reading my reply, I've made a typo there, sorry. What it
should have read is:
  The problem here is not having the returned ids in a particular
order, is that there is apparently no correlation with the position of
an element in the values clause with the id generated.

Of course sorting the returned ids is only viable when using a serial
or identity column, that's why in the general case I've mentioned the
insert with sentinel column to ask if there are better or alternative
solutions.

Thanks for the reply, best
    Federico

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



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

Предыдущее
От: "Mike Bayer"
Дата:
Сообщение: Re: Guidance on INSERT RETURNING order
Следующее
От: Thorsten Glaser
Дата:
Сообщение: Re: Guidance on INSERT RETURNING order