aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonfuncs.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2020-01-29 10:19:24 -0500
committerRobert Haas <rhaas@postgresql.org>2020-01-29 10:22:51 -0500
commitbeb4699091e9fab1c5f465056bef35c9ddf7f9fc (patch)
tree49206e96c8840b42e6462cfed38302e03cd9130c /src/backend/utils/adt/jsonfuncs.c
parentdc788668bb269b10a108e87d14fefd1b9301b793 (diff)
downloadpostgresql-beb4699091e9fab1c5f465056bef35c9ddf7f9fc.tar.gz
postgresql-beb4699091e9fab1c5f465056bef35c9ddf7f9fc.zip
Move jsonapi.c and jsonapi.h to src/common.
To make this work, (1) makeJsonLexContextCstringLen now takes the encoding to be used as an argument; (2) check_stack_depth() is made to do nothing in frontend code, and (3) elog(ERROR, ...) is changed to pg_log_fatal + exit in frontend code. Mark Dilger, reviewed and slightly revised by me. Discussion: http://postgr.es/m/CA+TgmoYfOXhd27MUDGioVh6QtpD0C1K-f6ObSA10AWiHBAL5bA@mail.gmail.com
Diffstat (limited to 'src/backend/utils/adt/jsonfuncs.c')
-rw-r--r--src/backend/utils/adt/jsonfuncs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c
index 66ea11b971c..4f6fd0de023 100644
--- a/src/backend/utils/adt/jsonfuncs.c
+++ b/src/backend/utils/adt/jsonfuncs.c
@@ -18,6 +18,7 @@
#include "access/htup_details.h"
#include "catalog/pg_type.h"
+#include "common/jsonapi.h"
#include "fmgr.h"
#include "funcapi.h"
#include "lib/stringinfo.h"
@@ -27,7 +28,6 @@
#include "utils/builtins.h"
#include "utils/hsearch.h"
#include "utils/json.h"
-#include "utils/jsonapi.h"
#include "utils/jsonb.h"
#include "utils/jsonfuncs.h"
#include "utils/lsyscache.h"
@@ -514,6 +514,7 @@ makeJsonLexContext(text *json, bool need_escapes)
{
return makeJsonLexContextCstringLen(VARDATA_ANY(json),
VARSIZE_ANY_EXHDR(json),
+ GetDatabaseEncoding(),
need_escapes);
}
@@ -2605,7 +2606,7 @@ populate_array_json(PopulateArrayContext *ctx, char *json, int len)
PopulateArrayState state;
JsonSemAction sem;
- state.lex = makeJsonLexContextCstringLen(json, len, true);
+ state.lex = makeJsonLexContextCstringLen(json, len, GetDatabaseEncoding(), true);
state.ctx = ctx;
memset(&sem, 0, sizeof(sem));
@@ -3448,7 +3449,7 @@ get_json_object_as_hash(char *json, int len, const char *funcname)
HASHCTL ctl;
HTAB *tab;
JHashState *state;
- JsonLexContext *lex = makeJsonLexContextCstringLen(json, len, true);
+ JsonLexContext *lex = makeJsonLexContextCstringLen(json, len, GetDatabaseEncoding(), true);
JsonSemAction *sem;
memset(&ctl, 0, sizeof(ctl));