From: Tom Lane <tgl@sss.pgh.pa.us>
To: Simon Riggs <simon.riggs@enterprisedb.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Bug in error reporting for multi-line JSON
Date: Thu, 21 Jan 2021 13:08:28 -0500
Message-ID: <914794.1611252508@sss.pgh.pa.us> (raw)
In-Reply-To: <CANbhV-EPBnXm3MF_TTWBwwqgn1a1Ghmep9VHfqmNBQ8BT0f+_g@mail.gmail.com>
References: <CANbhV-EPBnXm3MF_TTWBwwqgn1a1Ghmep9VHfqmNBQ8BT0f+_g@mail.gmail.com>
Simon Riggs <simon.riggs@enterprisedb.com> writes:
> JSON parsing reports the line number and relevant context info
> incorrectly when the JSON contains newlines. Current code mostly just
> says "LINE 1" and is misleading for error correction. There were no
> tests for this previously.
Couple thoughts:
* I think you are wrong to have removed the line number bump that
happened when report_json_context advances context_start over a
newline. The case is likely harder to get to now, but it can still
happen can't it? If it can't, we should remove that whole stanza.
* I'd suggest naming the new JsonLexContext field "pos_last_newline";
"linefeed" is not usually the word we use for this concept. (Although
actually, it might work better if you make that point to the char
*after* the newline, in which case "last_linestart" might be the
right name.)
* I'm not enthused about back-patching. This behavior seems like an
improvement, but that doesn't mean people will appreciate changing it
in stable branches.
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, simon.riggs@enterprisedb.com
Subject: Re: Bug in error reporting for multi-line JSON
In-Reply-To: <914794.1611252508@sss.pgh.pa.us>
* 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