Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1png98-0003JA-PE for pgsql-general@arkaria.postgresql.org; Sat, 15 Apr 2023 13:40:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1png96-0007jk-LT for pgsql-general@arkaria.postgresql.org; Sat, 15 Apr 2023 13:40:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1png96-0007jb-Ag for pgsql-general@lists.postgresql.org; Sat, 15 Apr 2023 13:40:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1png93-0033VI-Gw for pgsql-general@lists.postgresql.org; Sat, 15 Apr 2023 13:40:51 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 33FDei161678722; Sat, 15 Apr 2023 09:40:44 -0400 From: Tom Lane To: Federico cc: "David G. Johnston" , John Howroyd , pgsql-general@lists.postgresql.org Subject: Re: Guidance on INSERT RETURNING order In-reply-to: References: <95fbd8c8-2f7a-38a1-4a41-b2ac3763d89c@aklaver.com> <6644419d-50e1-97c9-5507-b6915bec96fa@gmail.com> <961adda9-4eb1-79f6-ee8f-9440a520ac15@gmail.com> <20230414164036.labzn5sbqzye7jvg@hjp.at> <1608813.1681528629@sss.pgh.pa.us> Comments: In-reply-to Federico message dated "Sat, 15 Apr 2023 08:54:36 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1678720.1681566044.1@sss.pgh.pa.us> Date: Sat, 15 Apr 2023 09:40:44 -0400 Message-ID: <1678721.1681566044@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Federico writes: > I think the tuple order would not be connected to the values, but be > determined by the input order of the rows in the insert. So when using > INSERT ... SELECT the tuple_order value would be determined by the > output of the select, using the same logic as ROW_NUMBER. We already rejected the idea that INSERT must preserve the order of the incoming tuples. Please don't re-propose it with different wording. regards, tom lane