Commit 1f3a021
committed
Adjust pg_parse_json() so that it does not directly ereport().
Instead, it now returns a value indicating either success or the
type of error which occurred. The old behavior is still available
by calling pg_parse_json_or_ereport(). If the new interface is
used, an error can be thrown by passing the return value of
pg_parse_json() to json_ereport_error().
pg_parse_json() can still elog() in can't-happen cases, but it
seems like that issue is best handled separately.
Adjust json_lex() and json_count_array_elements() to return an
error code, too.
This is all in preparation for making the backend's json parser
available to frontend code.
Reviewed and/or tested by Mark Dilger and Andrew Dunstan.
Discussion: http://postgr.es/m/CA+TgmoYfOXhd27MUDGioVh6QtpD0C1K-f6ObSA10AWiHBAL5bA@mail.gmail.com1 parent 3e4818e commit 1f3a021
File tree
5 files changed
+342
-283
lines changed- src
- backend/utils/adt
- include/utils
5 files changed
+342
-283
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
1337 | 1337 | | |
1338 | 1338 | | |
1339 | 1339 | | |
| 1340 | + | |
1340 | 1341 | | |
1341 | 1342 | | |
1342 | 1343 | | |
1343 | 1344 | | |
1344 | 1345 | | |
1345 | | - | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
1346 | 1349 | | |
1347 | 1350 | | |
1348 | 1351 | | |
| |||
0 commit comments