Re: Guidance on INSERT RETURNING order

Поиск
Список
Период
Сортировка
От Thorsten Glaser
Тема Re: Guidance on INSERT RETURNING order
Дата
Msg-id c422c4ef-a284-e45e-b968-27bff221e993@evolvis.org
обсуждение исходный текст
Ответ на Re: Guidance on INSERT RETURNING order  (Kirk Wolak <wolakk@gmail.com>)
Ответы Re: Guidance on INSERT RETURNING order  (Rob Sargent <robjsargent@gmail.com>)
Re: Guidance on INSERT RETURNING order  ("Mike Bayer" <mike_mp@zzzcomputing.com>)
Список pgsql-general
On Wed, 12 Apr 2023, Kirk Wolak wrote:

>The solution exists.  Pre-fetch the IDs, assign them and insert them with
>the IDs.  Then you have 100% control.
>SELECT NEXTVAL('tbl_seq') from GENERATE_SERIES(1, <total_needed>);

This would be a nice solution… but the PK could be always generated,
or not even sequential (UUIDs for example). If you’re developing
schema-first the application would not even (need to) know about how
the IDs are generated as it’s the DB that generates them.

AIUI the OP’s an SQLAlchemy developer, which is an ORM. Therefore he
needs a generic solution.

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



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

Предыдущее
От: Kirk Wolak
Дата:
Сообщение: Re: Guidance on INSERT RETURNING order
Следующее
От: Rob Sargent
Дата:
Сообщение: Re: Guidance on INSERT RETURNING order