From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Convert json_in and jsonb_in to report errors softly. |
Date: | 2022-12-11 16:28:24 |
Message-ID: | E1p4PBf-003329-Ec@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Convert json_in and jsonb_in to report errors softly.
This requires a bit of further infrastructure-extension to allow
trapping errors reported by numeric_in and pg_unicode_to_server,
but otherwise it's pretty straightforward.
In the case of jsonb_in, we are only capturing errors reported
during the initial "parse" phase. The value-construction phase
(JsonbValueToJsonb) can also throw errors if assorted implementation
limits are exceeded. We should improve that, but it seems like a
separable project.
Andrew Dunstan and Tom Lane
Discussion: https://postgr.es/m/3bac9841-fe07-713d-fa42-606c225567d6@dunslane.net
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/c60c9badba9b4db3155eef081ae0b923f983168c
Modified Files
--------------
src/backend/utils/adt/json.c | 7 ++--
src/backend/utils/adt/jsonb.c | 51 ++++++++++++++++--------
src/backend/utils/adt/jsonfuncs.c | 35 ++++++++++++----
src/backend/utils/fmgr/fmgr.c | 45 +++++++++++++++++++++
src/backend/utils/mb/mbutils.c | 57 +++++++++++++++++++++++++++
src/common/jsonapi.c | 17 ++++----
src/include/common/jsonapi.h | 1 +
src/include/fmgr.h | 4 ++
src/include/mb/pg_wchar.h | 1 +
src/include/utils/jsonfuncs.h | 13 ++++--
src/test/regress/expected/json.out | 19 +++++++++
src/test/regress/expected/json_encoding.out | 7 ++++
src/test/regress/expected/json_encoding_1.out | 31 ++++++++++++---
src/test/regress/expected/jsonb.out | 25 ++++++++++++
src/test/regress/sql/json.sql | 5 +++
src/test/regress/sql/json_encoding.sql | 4 ++
src/test/regress/sql/jsonb.sql | 6 +++
17 files changed, 282 insertions(+), 46 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2022-12-11 18:02:45 | pgsql: Convert domain_in to report errors softly. |
Previous Message | Tom Lane | 2022-12-10 23:26:54 | pgsql: Standardize error reports in unimplemented I/O functions. |