pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve reporting for syntax errors in multi-line JSON data.
Date: Mon, 01 Mar 2021 21:44:23 +0000
Message-ID: <E1lGqL1-0007R1-1F@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1lGqL1-0007R1-1F@gemulon.postgresql.org>
Permalink:  ../E1lGqL1-0007R1-1F@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lGqL1-0007R1-1F@gemulon.postgresql.org

 · 

reply

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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Improve reporting for syntax errors in multi-line JSON data.
  In-Reply-To: <E1lGqL1-0007R1-1F@gemulon.postgresql.org>
  References: <E1lGqL1-0007R1-1F@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