Re: making the backend's json parser work in frontend code
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Mark Dilger <mark.dilger@enterprisedb.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>,
David Steele <david@pgmasters.net>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2020-01-24T18:43:07Z
Lists: pgsql-hackers
On Thu, Jan 23, 2020 at 1:05 PM Mark Dilger <mark.dilger@enterprisedb.com> wrote: > Ok, I finished merging with Robert’s patches. The attached follow his numbering, with my patches intended to by applied after his. I think it'd be a good idea to move the pg_wchar.h stuff into a new thread. This thread is getting a bit complicated, because we've got (1) the patches need to do $SUBJECT plus (2) additional patches that clean up the multibyte stuff more plus (3) discussion of issues that pertain to the backup manifest thread. To my knowledge, $SUBJECT doesn't strictly require the pg_wchar.h changes, so I suggest we try to segregate those. > I tried not to change his work too much, but I did a bit of refactoring in 0010, as explained in the commit comment. Hmm, I generally prefer to avoid these kinds of macro tricks because I think they can be confusing to the reader. It's worth it in a case like equalfuncs.c where so much boilerplate code is saved that the gain in readability more than makes up for having to go check what the macros do -- but I don't feel that's the case here. There aren't *that* many call sites, and I think the code will be easier to understand without "return" statements concealed within macros... > I ran some benchmarks for json parsing in the backend both before and after these patches, with very slight changes in runtime. Cool, thanks. Since 0001-0003 have been reviewed by multiple people and nobody's objected, I have committed those. But I made a hash of it: the first one, I failed to credit any reviewers, or include a Discussion link, and I just realized that I should have listed Alvaro's name as a reviewer also. Sorry about that. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
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