Improve reporting for syntax errors in multi-line JSON data.
Tom Lane <tgl@sss.pgh.pa.us>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/adt/jsonfuncs.c | modified | +6 −17 |
| src/common/jsonapi.c | modified | +5 −3 |
| src/include/common/jsonapi.h | modified | +2 −2 |
| src/test/regress/expected/jsonb.out | modified | +31 −0 |
| src/test/regress/expected/json.out | modified | +35 −0 |
| src/test/regress/sql/jsonb.sql | modified | +17 −0 |
| src/test/regress/sql/json.sql | modified | +17 −0 |
Discussion
- Bug in error reporting for multi-line JSON 11 messages · 2021-01-20 → 2021-08-25