Re: jsonpath

From: Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Oleg Bartunov <obartunov(at)gmail(dot)com>, Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: jsonpath
Date: 2018-03-01 21:40:51
Message-ID: 94ace92c-714c-903c-fab2-31fb838204ad@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 28.02.2018 06:55, Robert Haas wrote:

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

In response to

Responses

  • Re: jsonpath at 2018-03-01 21:57:37 from Alexander Korotkov

Browse pgsql-hackers by date

  From Date Subject
Next Message David Steele 2018-03-01 21:51:39 Re: row filtering for logical replication
Previous Message Andres Freund 2018-03-01 21:36:23 Re: Optimize Arm64 crc32c implementation in Postgresql