pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleas Mantzios <a.mantzios@cloud.gatewaynet.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Guidance on INSERT RETURNING order
Date: Tue, 11 Apr 2023 23:17:43 +0300
Message-ID: <e6bd70b4-83a9-38d2-026d-e082f0896282@cloud.gatewaynet.com> (raw)
In-Reply-To: <95fbd8c8-2f7a-38a1-4a41-b2ac3763d89c@aklaver.com>
References: <CAN19dycS0oUorLOGgjxMX8NZq-hOA1RJrzwC4L3FxpMf4BQbBQ@mail.gmail.com>
	<95fbd8c8-2f7a-38a1-4a41-b2ac3763d89c@aklaver.com>

Στις 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






view thread (56+ messages)  latest in thread

Message-ID: <e6bd70b4-83a9-38d2-026d-e082f0896282@cloud.gatewaynet.com>
Permalink:  ../e6bd70b4-83a9-38d2-026d-e082f0896282@cloud.gatewaynet.com/
Also on:    postgresql.org/message-id/e6bd70b4-83a9-38d2-026d-e082f0896282@cloud.gatewaynet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: a.mantzios@cloud.gatewaynet.com
  Subject: Re: Guidance on INSERT RETURNING order
  In-Reply-To: <e6bd70b4-83a9-38d2-026d-e082f0896282@cloud.gatewaynet.com>
  References: <CAN19dycS0oUorLOGgjxMX8NZq-hOA1RJrzwC4L3FxpMf4BQbBQ@mail.gmail.com> <95fbd8c8-2f7a-38a1-4a41-b2ac3763d89c@aklaver.com> <e6bd70b4-83a9-38d2-026d-e082f0896282@cloud.gatewaynet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox