From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Adjust pg_parse_json() so that it does not directly ereport().
Date: Mon, 27 Jan 2020 16:19:42 +0000
Message-ID: <E1iw770-0005zi-SZ@gemulon.postgresql.org> (raw)
Adjust pg_parse_json() so that it does not directly ereport().
Instead, it now returns a value indicating either success or the
type of error which occurred. The old behavior is still available
by calling pg_parse_json_or_ereport(). If the new interface is
used, an error can be thrown by passing the return value of
pg_parse_json() to json_ereport_error().
pg_parse_json() can still elog() in can't-happen cases, but it
seems like that issue is best handled separately.
Adjust json_lex() and json_count_array_elements() to return an
error code, too.
This is all in preparation for making the backend's json parser
available to frontend code.
Reviewed and/or tested by Mark Dilger and Andrew Dunstan.
Discussion: http://postgr.es/m/CA+TgmoYfOXhd27MUDGioVh6QtpD0C1K-f6ObSA10AWiHBAL5bA@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/1f3a021730be98b880d94cabbe21de7e4d8136f5
Modified Files
--------------
src/backend/utils/adt/json.c | 9 +-
src/backend/utils/adt/jsonapi.c | 537 +++++++++++++++++++-------------------
src/backend/utils/adt/jsonb.c | 4 +-
src/backend/utils/adt/jsonfuncs.c | 29 +-
src/include/utils/jsonapi.h | 46 +++-
5 files changed, 342 insertions(+), 283 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: rhaas@postgresql.org
Subject: Re: pgsql: Adjust pg_parse_json() so that it does not directly ereport().
In-Reply-To: <E1iw770-0005zi-SZ@gemulon.postgresql.org>
References: <E1iw770-0005zi-SZ@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