aboutsummaryrefslogtreecommitdiff
path: root/src/include/common/jsonapi.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-03-01 16:44:17 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2021-03-01 16:44:17 -0500
commitffd3944ab9d481906137bc7d20f5325a2bd68acc (patch)
tree6c9b03abc608dc3ea73d8baf9179e9426016ca5d /src/include/common/jsonapi.h
parentbd69ddfcdbf650f11af4317f3f6686c012cf66d0 (diff)
downloadpostgresql-ffd3944ab9d481906137bc7d20f5325a2bd68acc.tar.gz
postgresql-ffd3944ab9d481906137bc7d20f5325a2bd68acc.zip
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
Diffstat (limited to 'src/include/common/jsonapi.h')
-rw-r--r--src/include/common/jsonapi.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/include/common/jsonapi.h b/src/include/common/jsonapi.h
index 03331f6d13f..ec3dfce9c32 100644
--- a/src/include/common/jsonapi.h
+++ b/src/include/common/jsonapi.h
@@ -79,8 +79,8 @@ typedef struct JsonLexContext
char *prev_token_terminator;
JsonTokenType token_type;
int lex_level;
- int line_number;
- char *line_start;
+ int line_number; /* line number, starting from 1 */
+ char *line_start; /* where that line starts within input */
StringInfo strval;
} JsonLexContext;