common/jsonapi: support libpq as a client

Based on a patch by Michael Paquier.

For libpq, use PQExpBuffer instead of StringInfo. This requires us to
track allocation failures so that we can return JSON_OUT_OF_MEMORY as
needed rather than exit()ing.

Author: Jacob Champion <[email protected]>
Co-authored-by: Michael Paquier <[email protected]>
Co-authored-by: Daniel Gustafsson <[email protected]>
Reviewed-by: Peter Eisentraut <[email protected]>
Discussion: 
https://www.postgresql.org/message-id/flat/[email protected]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0785d1b8b2fa27074eeb18a3ac1f2a0e76cb8339

Modified Files
--------------
src/common/Makefile                                |  23 +-
src/common/jsonapi.c                               | 473 +++++++++++++++------
src/common/meson.build                             |  35 +-
src/include/common/jsonapi.h                       |  18 +-
src/test/modules/test_json_parser/Makefile         |   7 +-
src/test/modules/test_json_parser/meson.build      |  12 +
.../t/001_test_json_parser_incremental.pl          |  25 +-
src/test/modules/test_json_parser/t/002_inline.pl  | 177 ++++----
.../test_json_parser/t/003_test_semantic.pl        |  31 +-
9 files changed, 558 insertions(+), 243 deletions(-)

Reply via email to