Re: making the backend's json parser work in frontend code
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2020-01-15T22:47:54Z
Lists: pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes: > ... However, I decided to spend today doing some further > investigation of an alternative approach, namely making the backend's > existing JSON parser work in frontend code as well. I did not solve > all the problems there, but I did come up with some patches which I > think would be worth committing on independent grounds, and I think > the whole series is worth posting. So here goes. In general, if we can possibly get to having one JSON parser in src/common, that seems like an obviously better place to be than having two JSON parsers. So I'm encouraged that it might be feasible after all. > 0001 moves wchar.c from src/backend/utils/mb to src/common. Unless I'm > missing something, this seems like an overdue cleanup. FWIW, I've been wanting to do that for awhile. I've not studied your patch, but +1 for the idea. We might also need to take a hard look at mbutils.c to see if any of that code can/should move. > Since I wrote my very first email complaining about the difficulty of > making the backend's JSON parser work in a frontend environment, one > obstacle has been knocked down: StringInfo is now available in > front-end code (commit 26aaf97b683d6258c098859e6b1268e1f5da242f). The > remaining problems (that I know about) have to do with error reporting > and multibyte character support; a read of the patches is suggested > for those wanting further details. The patch I just posted at <2863.1579127649@sss.pgh.pa.us> probably affects this in small ways, but not anything major. regards, tom lane
Commits
-
Add jsonapi.c to Mkvcbuild.pm's @pgcommonallfiles.
- 006b9dcad419 13.0 landed
-
Move jsonapi.c and jsonapi.h to src/common.
- beb4699091e9 13.0 landed
-
Move some code from jsonapi.c to jsonfuncs.c.
- 73ce2a03f30b 13.0 landed
-
Adjust pg_parse_json() so that it does not directly ereport().
- 1f3a021730be 13.0 landed
-
Remove jsonapi.c's lex_accept().
- 530609aa4263 13.0 landed
-
Split JSON lexer/parser from 'json' data type support.
- 11b5e3e35d39 13.0 landed
-
Rationalize code placement between wchar.c, encnames.c, and mbutils.c.
- 5afaa2e42655 13.0 landed
-
Move wchar.c and encnames.c to src/common/.
- e6afa8918c46 13.0 landed
-
Update header comments for wchar.c and encnames.c.
- 3d4cb5d6c180 13.0 landed
-
Make StringInfo available to frontend code.
- 26aaf97b683d 13.0 cited
-
Use SASLprep to normalize passwords for SCRAM authentication.
- 60f11b87a234 10.0 cited