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 1oe6L2-00026x-B5 for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Sep 2022 03:05:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oe6L0-0001S1-OY for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Sep 2022 03:05:18 +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 1oe6L0-0001Rs-EQ for pgsql-hackers@lists.postgresql.org; Fri, 30 Sep 2022 03:05:18 +0000 Received: from relay12.mail.gandi.net ([217.70.178.232]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oe6Kx-0002Fq-Bl for pgsql-hackers@lists.postgresql.org; Fri, 30 Sep 2022 03:05:17 +0000 Received: (Authenticated sender: adsend@dunslane.net) by mail.gandi.net (Postfix) with ESMTPSA id 76C29200006; Fri, 30 Sep 2022 03:05:09 +0000 (UTC) Message-ID: Date: Thu, 29 Sep 2022 23:05:07 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: SQL/JSON features for v15 Content-Language: en-US To: Nikita Glukhov , Tom Lane , Robert Haas Cc: Andres Freund , "Jonathan S. Katz" , Amit Langote , Alvaro Herrera , PostgreSQL Hackers , Michael Paquier , John Naylor References: <20220830092008.6dbublx6la226zis@alvherre.pgsql> <2276d20d-43ff-f9f6-5c9c-c2875739e66c@postgresql.org> <20220831154916.pgspuz3bp4427int@awork3.anarazel.de> <4151123.1661961884@sss.pgh.pa.us> <13351.1661965592@sss.pgh.pa.us> <14814.1661966096@sss.pgh.pa.us> <379e5365-9670-e0de-ee08-57ba61cbc976@postgrespro.ru> <0574201c-bd35-01af-1557-8936f99ce5aa@postgrespro.ru> From: Andrew Dunstan In-Reply-To: <0574201c-bd35-01af-1557-8936f99ce5aa@postgrespro.ru> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022-09-01 Th 09:54, Nikita Glukhov wrote: > > On 31.08.2022 23:39, Nikita Glukhov wrote: > >> And here is a quick POC patch with an example for COPY and float4 > I decided to go further and use new API in SQL/JSON functions > (even if it does not make real sense now). > > I have added function for checking expressions trees, special > executor steps for handling errors in FuncExpr, CoerceViaIO, > CoerceToDomain which are passed through ExprState.edata. > > Of course, there is still a lot of work: > 1. JIT for new expression steps > 2. Removal of subsidary ExprStates (needs another solution for > ErrorData passing) >   3. Checking of domain constraint expressions > 4. Error handling in coercion to bytea > 5. Error handling in json_populate_type() > 6. Error handling in jsonb::type casts > 7. ... > > > Also I have added lazy creation of JSON_VALUE coercions, which was > not present in previous patches. It really greatly speeds up JIT > and reduces memory consumption. But it requires using of subsidary > ExprStates. > > > jsonb_sqljson test now fails because of points 4, 5, 6. It looks like this needs to be rebased anyway. I suggest just submitting the Input function stuff on its own, I think that means not patches 3,4,15 at this stage. Maybe we would also need a small test module to call the functions, or at least some of them. The earlier we can get this in the earlier SQL/JSON patches based on it can be considered. A few comments: . proissafe isn't really a very informative name. Safe for what? maybe proerrorsafe or something would be better? . I don't think we need the if test or else clause here: +   if (edata) +       return InputFunctionCallInternal(flinfo, str, typioparam, typmod, edata); +   else +       return InputFunctionCall(flinfo, str, typioparam, typmod); . I think we should probably cover float8 as well as float4, and there might be some other odd gaps. As mentioned previously, this should really go in a new thread, so please don't reply to this but start a completely new thread. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com