pgsql: Improve reporting for syntax errors in multi-line JSON data.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Improve reporting for syntax errors in multi-line JSON data.
Date: 2021-03-01 21:44:23
Message-ID: E1lGqL1-0007R1-1F@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve reporting for syntax errors in multi-line JSON data.

Point to the specific line where the error was detected; the
previous code tended to include several preceding lines as well.
Avoid re-scanning the entire input to recompute which line that
was. Simplify the logic a bit. Add test cases.

Simon Riggs and Hamid Akhtar, reviewed by Daniel Gustafsson and myself

Discussion: https://postgr.es/m/CANbhV-EPBnXm3MF_TTWBwwqgn1a1Ghmep9VHfqmNBQ8BT0f+_g@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ffd3944ab9d481906137bc7d20f5325a2bd68acc

Modified Files
--------------
src/backend/utils/adt/jsonfuncs.c | 23 ++++++-----------------
src/common/jsonapi.c | 8 +++++---
src/include/common/jsonapi.h | 4 ++--
src/test/regress/expected/json.out | 35 +++++++++++++++++++++++++++++++++++
src/test/regress/expected/jsonb.out | 31 +++++++++++++++++++++++++++++++
src/test/regress/sql/json.sql | 17 +++++++++++++++++
src/test/regress/sql/jsonb.sql | 17 +++++++++++++++++
7 files changed, 113 insertions(+), 22 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2021-03-02 01:28:42 pgsql: doc: Mention archive_command failure handling on signals
Previous Message Thomas Munro 2021-03-01 20:31:15 pgsql: Remove obsolete comment for WaitForProcSignalBarrier().