Split JSON lexer/parser from 'json' data type support.
Robert Haas <rhaas@postgresql.org>
Split JSON lexer/parser from 'json' data type support. Keep the code that pertains to the 'json' data type in json.c, but move the lexing and parsing code to a new file jsonapi.c, a name I chose because the corresponding prototypes are in jsonapi.h. This seems like a logical division, because the JSON lexer and parser are also used by the 'jsonb' data type, but the SQL-callable functions in json.c are a separate thing. Also, the new jsonapi.c file needs to include far fewer header files than json.c, which seems like a good sign that this is an appropriate place to insert an abstraction boundary. I took the opportunity to remove a few apparently-unneeded includes from json.c at the same time. Patch by me, reviewed by David Steele, Mark Dilger, and Andrew Dunstan. The previous commit was, too, but I forgot to note it in the commit message. Discussion: http://postgr.es/m/CA+TgmoYfOXhd27MUDGioVh6QtpD0C1K-f6ObSA10AWiHBAL5bA@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/adt/jsonapi.c | added | +1216 −0 |
| src/backend/utils/adt/json.c | modified | +1 −1205 |
| src/backend/utils/adt/Makefile | modified | +1 −0 |
| src/include/utils/jsonapi.h | modified | +6 −0 |
Discussion
- making the backend's json parser work in frontend code 101 messages · 2020-01-15 → 2020-01-30