diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/common/jsonapi.h | 1 | ||||
-rw-r--r-- | src/include/fmgr.h | 4 | ||||
-rw-r--r-- | src/include/mb/pg_wchar.h | 1 | ||||
-rw-r--r-- | src/include/utils/jsonfuncs.h | 13 |
4 files changed, 15 insertions, 4 deletions
diff --git a/src/include/common/jsonapi.h b/src/include/common/jsonapi.h index 663064e659d..884c86cae7f 100644 --- a/src/include/common/jsonapi.h +++ b/src/include/common/jsonapi.h @@ -51,6 +51,7 @@ typedef enum JsonParseErrorType JSON_UNICODE_CODE_POINT_ZERO, JSON_UNICODE_ESCAPE_FORMAT, JSON_UNICODE_HIGH_ESCAPE, + JSON_UNICODE_UNTRANSLATABLE, JSON_UNICODE_HIGH_SURROGATE, JSON_UNICODE_LOW_SURROGATE, JSON_SEM_ACTION_FAILED /* error should already be reported */ diff --git a/src/include/fmgr.h b/src/include/fmgr.h index b7832d0aa2a..972afe3aff9 100644 --- a/src/include/fmgr.h +++ b/src/include/fmgr.h @@ -704,6 +704,10 @@ extern bool InputFunctionCallSafe(FmgrInfo *flinfo, char *str, Oid typioparam, int32 typmod, fmNodePtr escontext, Datum *result); +extern bool DirectInputFunctionCallSafe(PGFunction func, char *str, + Oid typioparam, int32 typmod, + fmNodePtr escontext, + Datum *result); extern Datum OidInputFunctionCall(Oid functionId, char *str, Oid typioparam, int32 typmod); extern char *OutputFunctionCall(FmgrInfo *flinfo, Datum val); diff --git a/src/include/mb/pg_wchar.h b/src/include/mb/pg_wchar.h index 4f2643742e1..7aa0bc1c590 100644 --- a/src/include/mb/pg_wchar.h +++ b/src/include/mb/pg_wchar.h @@ -650,6 +650,7 @@ extern char *pg_any_to_server(const char *s, int len, int encoding); extern char *pg_server_to_any(const char *s, int len, int encoding); extern void pg_unicode_to_server(pg_wchar c, unsigned char *s); +extern bool pg_unicode_to_server_noerror(pg_wchar c, unsigned char *s); extern unsigned short BIG5toCNS(unsigned short big5, unsigned char *lc); extern unsigned short CNStoBIG5(unsigned short cns, unsigned char lc); diff --git a/src/include/utils/jsonfuncs.h b/src/include/utils/jsonfuncs.h index 865b2ff7c11..7fad0269f62 100644 --- a/src/include/utils/jsonfuncs.h +++ b/src/include/utils/jsonfuncs.h @@ -39,11 +39,16 @@ typedef text *(*JsonTransformStringValuesAction) (void *state, char *elem_value, /* build a JsonLexContext from a text datum */ extern JsonLexContext *makeJsonLexContext(text *json, bool need_escapes); -/* try to parse json, and ereport(ERROR) on failure */ -extern void pg_parse_json_or_ereport(JsonLexContext *lex, JsonSemAction *sem); +/* try to parse json, and errsave(escontext) on failure */ +extern bool pg_parse_json_or_errsave(JsonLexContext *lex, JsonSemAction *sem, + struct Node *escontext); -/* report an error during json lexing or parsing */ -extern void json_ereport_error(JsonParseErrorType error, JsonLexContext *lex); +#define pg_parse_json_or_ereport(lex, sem) \ + (void) pg_parse_json_or_errsave(lex, sem, NULL) + +/* save an error during json lexing or parsing */ +extern void json_errsave_error(JsonParseErrorType error, JsonLexContext *lex, + struct Node *escontext); extern uint32 parse_jsonb_index_flags(Jsonb *jb); extern void iterate_jsonb_values(Jsonb *jb, uint32 flags, void *state, |