From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Adjust string comparison in jsonpath
Date: Sun, 11 Aug 2019 20:10:45 +0000
Message-ID: <E1hwuAv-0003SM-Tv@gemulon.postgresql.org> (raw)
Adjust string comparison in jsonpath
We have implemented jsonpath string comparison using default database locale.
However, standard requires us to compare Unicode codepoints. This commit
implements that, but for performance reasons we still use per-byte comparison
for "==" operator. Thus, for consistency other comparison operators do per-byte
comparison if Unicode codepoints appear to be equal.
In some edge cases, when same Unicode codepoints have different binary
representations in database encoding, we diverge standard to achieve better
performance of "==" operator. In future to implement strict standard
conformance, we can do normalization of input JSON strings.
Original patch was written by Nikita Glukhov, rewritten by me.
Reported-by: Markus Winand
Discussion: https://postgr.es/m/8B7FA3B4-328D-43D7-95A8-37B8891B8C78%40winand.at
Author: Nikita Glukhov, Alexander Korotkov
Backpatch-through: 12
Branch
------
REL_12_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/3218ff5c6aea5841ab547ecca26927716419fe4b
Modified Files
--------------
src/backend/utils/adt/jsonpath_exec.c | 72 +++++++++++-
src/test/regress/expected/jsonb_jsonpath.out | 163 +++++++++++++++++++++++++++
src/test/regress/sql/jsonb_jsonpath.sql | 16 +++
3 files changed, 248 insertions(+), 3 deletions(-)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: akorotkov@postgresql.org
Subject: Re: pgsql: Adjust string comparison in jsonpath
In-Reply-To: <E1hwuAv-0003SM-Tv@gemulon.postgresql.org>
References: <E1hwuAv-0003SM-Tv@gemulon.postgresql.org>
* 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