pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nikita Glukhov <n.gluhov@postgrespro.ru>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Oleg Bartunov <obartunov@gmail.com>
Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: jsonpath
Date: Fri, 2 Mar 2018 00:40:51 +0300
Message-ID: <94ace92c-714c-903c-fab2-31fb838204ad@postgrespro.ru> (raw)
In-Reply-To: <CA+TgmoYXtoPPaV-OEUfqujCcfKp+ZT=KOuPHkhRoQL_iYzQ8yQ@mail.gmail.com>
References: <fcc6fc6a-b497-f39a-923d-aa34d0c588e8@2ndQuadrant.com>
	<CAFj8pRAhPnD=sPu-E=rwfcbgeZ8PLczYEzCsvgNYLtybSy9-=g@mail.gmail.com>
	<9f845926-0d7d-7c4d-75e3-b1e921a1677a@2ndQuadrant.com>
	<CAFj8pRBCvhgLCROfSCPGmwWZpSY+dKQN4O9xRe+1-wjBiXiHkA@mail.gmail.com>
	<bad98003-31ba-523e-d76c-3679efb2e732@2ndQuadrant.com>
	<CAFj8pRDWSCWd1JxA8srwbfL5cPgz2b5minq2UsM=cxgsFF-orw@mail.gmail.com>
	<48f13b75-0be7-c356-ff26-1db743add56e@postgrespro.ru>
	<7b4b8973-43f5-71c5-bf86-51cb5798dd88@2ndQuadrant.com>
	<f0b44fe7-d47a-eff2-592c-d9dbe4a63f75@2ndQuadrant.com>
	<5290ddd1-f23e-a53a-cae0-830dbde0a5fe@2ndQuadrant.com>
	<604ffe9c-b42e-7c42-e16b-aa44c3a12c3c@postgrespro.ru>
	<927f72f0-6832-a4ca-5676-b0ab5a2895d4@postgrespro.ru>
	<CAF4Au4wxHuEeZrMxxKXUYcs1kDws-f0oW0-sEyun388-U-NOxw@mail.gmail.com>
	<9a1ac993-7608-797c-2095-c735605da82f@postgrespro.ru>
	<CA+TgmoYXtoPPaV-OEUfqujCcfKp+ZT=KOuPHkhRoQL_iYzQ8yQ@mail.gmail.com>

On 28.02.2018 06:55, Robert Haas wrote:

> On Mon, Feb 26, 2018 at 10:34 AM, Nikita Glukhov
> <n.gluhov@postgrespro.ru> 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





view thread (198+ messages)  latest in thread

Message-ID: <94ace92c-714c-903c-fab2-31fb838204ad@postgrespro.ru>
Permalink:  ../94ace92c-714c-903c-fab2-31fb838204ad@postgrespro.ru/
Also on:    postgresql.org/message-id/94ace92c-714c-903c-fab2-31fb838204ad@postgrespro.ru

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: n.gluhov@postgrespro.ru, robertmhaas@gmail.com, obartunov@gmail.com, andrew.dunstan@2ndquadrant.com, pavel.stehule@gmail.com
  Subject: Re: jsonpath
  In-Reply-To: <94ace92c-714c-903c-fab2-31fb838204ad@postgrespro.ru>

* 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