Re: jsonpath

From: Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>
To: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Oleg Bartunov <obartunov(at)postgrespro(dot)ru>, Michael Paquier <michael(at)paquier(dot)xyz>, Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, David Steele <david(at)pgmasters(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Subject: Re: jsonpath
Date: 2019-03-22 00:15:07
Message-ID: ac6e91d7-00fc-1123-9ecc-cf15c14038fc@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

Hi.

Attached patch enables throwing of errors in jsonb_path_match() in its
non-silent mode when the jsonpath expression failed to return a singleton
boolean. Previously, NULL was always returned, and it seemed to be
inconsistent with the behavior of other functions, in which structural and
other errors were not suppressed in non-silent mode.

We also think that jsonb_path_match() needs to be renamed, because its
current name is confusing to many users. "Match" name is more suitable for
jsonpath-based pattern matching like that (maybe we'll implement it later):

jsonb_path_match(
'{ "a": 1, "b": 2, "c": "str" }',
'{ "a": 1, "b": @ > 1, * : @.type == "string" }'
)

Below are some possible name variants:

jsonb_path_predicate() (original name)
jsonb_path_pred()
jsonb_path_test()
jsonb_path_check()
jsonb_path_bool()

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
0001-Throw-error-in-jsonb_path_match-when-silent-is-false.patch text/x-patch 5.2 KB

In response to

  • Re: jsonpath at 2019-03-21 13:58:46 from Alexander Korotkov

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2019-03-22 00:21:56 Re: ToDo: show size of partitioned table
Previous Message Lucas Viecelli 2019-03-21 22:45:59 warning to publication created and wal_level is not set to logical