Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sEBMC-0004v6-Sd for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Jun 2024 17:20:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sEBMC-00Bjzr-Ri for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Jun 2024 17:20:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sEBMC-00Bjzi-I7 for pgsql-hackers@lists.postgresql.org; Mon, 03 Jun 2024 17:20:28 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sEBMA-003HNy-4y for pgsql-hackers@lists.postgresql.org; Mon, 03 Jun 2024 17:20:27 +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 453HKMgI075665; Mon, 3 Jun 2024 13:20:22 -0400 From: Tom Lane To: Peter Eisentraut cc: Amit Langote , Alvaro Herrera , pgsql-hackers@lists.postgresql.org Subject: Re: pgsql: Add more SQL/JSON constructor functions In-reply-to: <65d2544e-4a11-448d-9683-7bce0d43565d@eisentraut.org> References: <202405271313.qkl63gffldmx@alvherre.pgsql> <202405271326.5a5rprki64aw@alvherre.pgsql> <3189.1717001075@sss.pgh.pa.us> <50a780ab-f1a4-4c5f-b9a1-88a174cf12af@eisentraut.org> <2416639.1717389996@sss.pgh.pa.us> <65d2544e-4a11-448d-9683-7bce0d43565d@eisentraut.org> Comments: In-reply-to Peter Eisentraut message dated "Mon, 03 Jun 2024 11:15:37 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <75663.1717435222.1@sss.pgh.pa.us> Date: Mon, 03 Jun 2024 13:20:22 -0400 Message-ID: <75664.1717435222@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter Eisentraut writes: > On 02.06.24 21:46, Tom Lane wrote: >> If you don't >> like our current behavior, then either you have to say that RETURNING >> with a length-limited target type is illegal (which is problematic >> for the spec, since they have no such type) or that the cast behaves >> like an implicit cast, with errors for overlength input (which I find >> to be an unintuitive definition for a construct that names the target >> type explicitly). > It asks for the latter behavior, essentially (but it's not defined in > terms of casts). It says: Meh. Who needs consistency? But I guess the answer is to do what was suggested earlier and change the code to use COERCE_IMPLICIT_CAST. regards, tom lane