From: | Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Bug in error reporting for multi-line JSON |
Date: | 2021-01-20 06:58:09 |
Message-ID: | CANbhV-EPBnXm3MF_TTWBwwqgn1a1Ghmep9VHfqmNBQ8BT0f+_g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
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.
Proposed changes mean a JSON error such as this
{
"one": 1,
"two":,"two", <-- extra comma
"three": true
}
was previously reported as
CONTEXT: JSON data, line 1: {
"one": 1,
"two":,...
should be reported as
CONTEXT: JSON data, line 3: "two":,...
Attached patches:
HEAD: json_error_context.v3.patch - applies cleanly, passes make check
PG13: json_error_context.v3.patch - applies w minor fuzz, passes make check
PG12: json_error_context.v3.PG12.patch - applies cleanly, passes make check
PG11: json_error_context.v3.PG12.patch - applies cleanly, not tested
PG10: json_error_context.v3.PG12.patch - applies cleanly, not tested
PG9.6: json_error_context.v3.PG12.patch - applies cleanly, not tested
PG9.5: json_error_context.v3.PG12.patch - applies cleanly, not tested
--
Simon Riggs http://www.EnterpriseDB.com/
Attachment | Content-Type | Size |
---|---|---|
json_error_context.v3.PG12.patch | application/octet-stream | 4.5 KB |
json_error_context.v3.patch | application/octet-stream | 5.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2021-01-20 07:24:47 | Re: BUG #16825: When building on Windows, cl /? retrun 'x64' not AMD64 and the build does not create x64 environment |
Previous Message | Heikki Linnakangas | 2021-01-19 22:31:30 | Re: Reproducible GIST index corruption under concurrent updates |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2021-01-20 07:13:50 | Re: a misbehavior of partition row movement (?) |
Previous Message | Peter Eisentraut | 2021-01-20 06:50:17 | Re: Boundary value check in lazy_tid_reaped() |