pgsql: Improve reporting for syntax errors in multi-line JSON data.
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: /messages/by-id/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(-)