Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1erW0C-0005Wx-3K for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Mar 2018 21:44:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1erW0A-0007zr-SN for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Mar 2018 21:44:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1erW0A-0007zh-GM for pgsql-hackers@lists.postgresql.org; Thu, 01 Mar 2018 21:44:34 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1erW06-0004kG-L1 for pgsql-hackers@postgresql.org; Thu, 01 Mar 2018 21:44:34 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 75AA421CA044; Fri, 2 Mar 2018 00:44:28 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [10.100.236.30] (unknown [195.82.154.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id B2BDF21C4322; Fri, 2 Mar 2018 00:44:26 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1519940668; bh=bMBSDfPUF+jOr24KIY8zIjSfnqe6h581IYQjzPA7tNA=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=RBhGS5vWwpMJIZyJ47bQG5swsBf2hcYzriIYenXHCsCdNlaqONoUWcKq2isz9D3Nw z8P6sHI3vK21rZ1++2NjruVqXdjuDL/XZc61TSrRTvIce4aYtwy0Sr8VxpivQljk+C HvW1Q0q+stnfzD7f1jMREPHiqKRp5a8IMm9atSLI= Subject: Re: jsonpath To: Robert Haas Cc: Oleg Bartunov , Andrew Dunstan , Pavel Stehule , PostgreSQL-development References: <9f845926-0d7d-7c4d-75e3-b1e921a1677a@2ndQuadrant.com> <48f13b75-0be7-c356-ff26-1db743add56e@postgrespro.ru> <7b4b8973-43f5-71c5-bf86-51cb5798dd88@2ndQuadrant.com> <5290ddd1-f23e-a53a-cae0-830dbde0a5fe@2ndQuadrant.com> <604ffe9c-b42e-7c42-e16b-aa44c3a12c3c@postgrespro.ru> <927f72f0-6832-a4ca-5676-b0ab5a2895d4@postgrespro.ru> <9a1ac993-7608-797c-2095-c735605da82f@postgrespro.ru> From: Nikita Glukhov Organization: Postgres Professional Message-ID: <94ace92c-714c-903c-fab2-31fb838204ad@postgrespro.ru> Date: Fri, 2 Mar 2018 00:40:51 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 28.02.2018 06:55, Robert Haas wrote: > On Mon, Feb 26, 2018 at 10:34 AM, Nikita Glukhov > wrote: >> Attached 10th version of the jsonpath patches. >> >> 1. Fixed error handling in arithmetic operators. >> >> Now run-time errors in arithmetic operators are catched (added >> PG_TRY/PG_CATCH around operator's functions calls) and converted into >> Unknown values in predicates as it is required by the standard: > I think we really need to rename PG_TRY and PG_CATCH or rethink this > whole interface so that people stop thinking they can use it to > prevent errors from being thrown. I understand that it is unsafe to call arbitrary function inside PG_TRY without rethrowing of caught errors in PG_CATCH, but in jsonpath only the following numeric and datetime functions with known behavior are called inside PG_TRY and only errors of category ERRCODE_DATA_EXCEPTION are caught: numeric_add() numeric_mul() numeric_div() numeric_mod() numeric_float8() float8in() float8_numeric() to_datetime() SQL/JSON standard requires us to handle errors and then perform the specified ON ERROR behavior. In the next SQL/JSON patch I had to use subtransactions for catching errors in JSON_VALUE, JSON_QUERY and JSON_EXISTS where an arbitrary user-defined typecast function can be called. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company