Re: Guidance on INSERT RETURNING order
| От | Achilleas Mantzios |
|---|---|
| Тема | Re: Guidance on INSERT RETURNING order |
| Дата | |
| Msg-id | e6bd70b4-83a9-38d2-026d-e082f0896282@cloud.gatewaynet.com обсуждение исходный текст |
| Ответ на | Re: Guidance on INSERT RETURNING order (Adrian Klaver <adrian.klaver@aklaver.com>) |
| Список | pgsql-general |
Στις 11/4/23 23:06, ο/η Adrian Klaver έγραψε: > On 4/11/23 12:47, Federico wrote: >> Hello list, >> > https://www.sqlite.org/lang_returning.html#limitations_and_caveats >> >> Searching the archive seems that a using the INSERT SELECT ORDER BY >> form should be a better solution, >> so the above insert should be rewritten as >> >> INSERT INTO t(data) >> SELECT data FROM (VALUES ('a', 1), ('b', 2), ('c', 3)) as vv(data, >> num) ORDER BY num >> RETURNING id > > Or > > with i as (INSERT INTO t(data) VALUES ('a', 1), ('b', 2), ('c', 3) > returning id) > select i.id from i order by id; +1 for this version! > >> Sorry for the long email, >> Thanks >> >> Federico >> >> > -- Achilleas Mantzios IT DEV - HEAD IT DEPT Dynacom Tankers Mgmt
В списке pgsql-general по дате отправления: