Re: Guidance on INSERT RETURNING order

Поиск
Список
Период
Сортировка
От Thorsten Glaser
Тема Re: Guidance on INSERT RETURNING order
Дата
Msg-id 2b8d529a-0ec-4e8f-26d3-2ef2881a2d49@evolvis.org
обсуждение исходный текст
Ответ на Re: Guidance on INSERT RETURNING order  (Federico <cfederico87@gmail.com>)
Ответы Re: Guidance on INSERT RETURNING order
Список pgsql-general
On Tue, 11 Apr 2023, Federico wrote:

>My understanding was that they are generated in select order

But are they? (I don’t know, but I’d not assume that.)

>If my understanding is incorrect, would this alternative guarantee the above

>    INSERT INTO t(id, data)
>    SELECT nextval(pg_get_serial_sequence('t', 'id')) data
>    FROM (VALUES ('a', 1), ('b', 2), ('c', 3)) as vv(data, num)
>    ORDER BY num
>    RETURNING id

Wouldn’t, at that point, it be better to just send multiple
individual INSERT statements? The overhead (on both sides)
for all mentioned… workarounds… surely is larger than that?

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



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