PostgreSQL Source Code
git master
|
Go to the source code of this file.
Macros | |
#define | pg_parse_json_or_ereport(lex, sem) (void) pg_parse_json_or_errsave(lex, sem, NULL) |
Typedefs | |
typedef enum JsonToIndex | JsonToIndex |
typedef void(* | JsonIterateStringValuesAction) (void *state, char *elem_value, int elem_len) |
typedef text *(* | JsonTransformStringValuesAction) (void *state, char *elem_value, int elem_len) |
Enumerations | |
enum | JsonToIndex { jtiKey = 0x01 , jtiString = 0x02 , jtiNumeric = 0x04 , jtiBool = 0x08 , jtiAll = jtiKey | jtiString | jtiNumeric | jtiBool } |
enum | JsonTypeCategory { JSONTYPE_NULL , JSONTYPE_BOOL , JSONTYPE_NUMERIC , JSONTYPE_DATE , JSONTYPE_TIMESTAMP , JSONTYPE_TIMESTAMPTZ , JSONTYPE_JSON , JSONTYPE_JSONB , JSONTYPE_ARRAY , JSONTYPE_COMPOSITE , JSONTYPE_CAST , JSONTYPE_OTHER } |
#define pg_parse_json_or_ereport | ( | lex, | |
sem | |||
) | (void) pg_parse_json_or_errsave(lex, sem, NULL) |
Definition at line 47 of file jsonfuncs.h.
typedef void(* JsonIterateStringValuesAction) (void *state, char *elem_value, int elem_len) |
Definition at line 35 of file jsonfuncs.h.
typedef enum JsonToIndex JsonToIndex |
Definition at line 38 of file jsonfuncs.h.
enum JsonToIndex |
enum JsonTypeCategory |
Definition at line 68 of file jsonfuncs.h.
Datum datum_to_json | ( | Datum | val, |
JsonTypeCategory | tcategory, | ||
Oid | outfuncoid | ||
) |
Definition at line 763 of file json.c.
References cstring_to_text_with_len(), StringInfoData::data, datum_to_json_internal(), StringInfoData::len, makeStringInfo(), PointerGetDatum(), and val.
Referenced by ExecEvalJsonConstructor(), and to_json().
Datum datum_to_jsonb | ( | Datum | val, |
JsonTypeCategory | tcategory, | ||
Oid | outfuncoid | ||
) |
Definition at line 1112 of file jsonb.c.
References datum_to_jsonb_internal(), JsonbPGetDatum(), JsonbValueToJsonb(), JsonbInState::res, and val.
Referenced by ExecEvalJsonConstructor(), and to_jsonb().
void iterate_json_values | ( | text * | json, |
uint32 | flags, | ||
void * | action_state, | ||
JsonIterateStringValuesAction | action | ||
) |
Definition at line 5709 of file jsonfuncs.c.
References generate_unaccent_rules::action, freeJsonLexContext(), iterate_values_object_field_start(), iterate_values_scalar(), makeJsonLexContext(), JsonSemAction::object_field_start, palloc0(), pg_parse_json_or_ereport, JsonSemAction::scalar, sem, and JsonSemAction::semstate.
Referenced by json_to_tsvector_worker().
void iterate_jsonb_values | ( | Jsonb * | jb, |
uint32 | flags, | ||
void * | state, | ||
JsonIterateStringValuesAction | action | ||
) |
Definition at line 5641 of file jsonfuncs.c.
References generate_unaccent_rules::action, DatumGetCString(), DirectFunctionCall1, jbvBool, jbvNumeric, jbvString, JsonbIteratorInit(), JsonbIteratorNext(), jtiBool, jtiKey, jtiNumeric, jtiString, numeric_out(), NumericGetDatum(), pfree(), Jsonb::root, type, JsonbValue::type, JsonbValue::val, val, WJB_DONE, WJB_ELEM, WJB_KEY, and WJB_VALUE.
Referenced by jsonb_to_tsvector_worker().
void json_categorize_type | ( | Oid | typoid, |
bool | is_jsonb, | ||
JsonTypeCategory * | tcategory, | ||
Oid * | outfuncoid | ||
) |
Definition at line 5976 of file jsonfuncs.c.
References COERCION_EXPLICIT, COERCION_PATH_FUNC, find_coercion_pathway(), FirstNormalObjectId, get_element_type(), getBaseType(), getTypeOutputInfo(), InvalidOid, JSONTYPE_ARRAY, JSONTYPE_BOOL, JSONTYPE_CAST, JSONTYPE_COMPOSITE, JSONTYPE_DATE, JSONTYPE_JSON, JSONTYPE_JSONB, JSONTYPE_NUMERIC, JSONTYPE_OTHER, JSONTYPE_TIMESTAMP, JSONTYPE_TIMESTAMPTZ, OidIsValid, and type_is_rowtype().
Referenced by add_json(), add_jsonb(), array_to_json_internal(), array_to_jsonb_internal(), composite_to_json(), composite_to_jsonb(), ExecInitExprRec(), json_agg_transfn_worker(), json_object_agg_transfn_worker(), jsonb_agg_transfn_worker(), jsonb_object_agg_transfn_worker(), to_json(), to_json_is_immutable(), to_jsonb(), and to_jsonb_is_immutable().
void json_errsave_error | ( | JsonParseErrorType | error, |
JsonLexContext * | lex, | ||
struct Node * | escontext | ||
) |
Definition at line 640 of file jsonfuncs.c.
References elog, errcode(), errdetail_internal(), errmsg(), ERROR, error(), errsave, json_errdetail(), JSON_SEM_ACTION_FAILED, JSON_UNICODE_CODE_POINT_ZERO, JSON_UNICODE_HIGH_ESCAPE, JSON_UNICODE_UNTRANSLATABLE, report_json_context(), and SOFT_ERROR_OCCURRED.
Referenced by get_array_start(), json_get_first_token(), json_typeof(), json_validate(), and pg_parse_json_or_errsave().
JsonTokenType json_get_first_token | ( | text * | json, |
bool | throw_error | ||
) |
Definition at line 5949 of file jsonfuncs.c.
References json_errsave_error(), json_lex(), JSON_SUCCESS, JSON_TOKEN_INVALID, makeJsonLexContext(), and JsonLexContext::token_type.
Referenced by ExecEvalJsonIsPredicate().
Datum json_populate_type | ( | Datum | json_val, |
Oid | json_type, | ||
Oid | typid, | ||
int32 | typmod, | ||
void ** | cache, | ||
MemoryContext | mcxt, | ||
bool * | isnull, | ||
bool | omit_quotes, | ||
Node * | escontext | ||
) |
Definition at line 3344 of file jsonfuncs.c.
References DatumGetJsonbP(), DatumGetTextPP, JsValue::is_json, jbvBinary, jbvString, JsValue::json, JSON_TOKEN_INVALID, JsValue::jsonb, JsonbUnquote(), MemoryContextAllocZero(), PointerGetDatum(), populate_record_field(), Jsonb::root, str, JsonbValue::type, JsValue::val, JsonbValue::val, VARDATA_ANY, VARHDRSZ, VARSIZE, and VARSIZE_ANY_EXHDR.
Referenced by ExecEvalJsonCoercion().
Definition at line 147 of file jsonb.c.
References jsonb_from_cstring(), VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Referenced by ExecEvalJsonConstructor().
JsonLexContext* makeJsonLexContext | ( | JsonLexContext * | lex, |
text * | json, | ||
bool | need_escapes | ||
) |
Definition at line 539 of file jsonfuncs.c.
References GetDatabaseEncoding(), makeJsonLexContextCstringLen(), pg_detoast_datum_packed(), VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Referenced by datum_to_jsonb_internal(), each_worker(), elements_worker(), get_worker(), iterate_json_values(), json_array_length(), json_get_first_token(), json_in(), json_object_keys(), json_strip_nulls(), json_typeof(), json_validate(), populate_recordset_worker(), and transform_json_string_values().
Definition at line 5573 of file jsonfuncs.c.
References elog, ereport, errcode(), errhint(), errmsg(), ERROR, jbvString, JsonbIteratorInit(), JsonbIteratorNext(), jtiAll, jtiBool, jtiKey, jtiNumeric, jtiString, pg_strncasecmp(), pnstrdup(), Jsonb::root, type, JsonbValue::type, JsonbValue::val, WJB_BEGIN_ARRAY, WJB_DONE, WJB_ELEM, and WJB_END_ARRAY.
Referenced by json_to_tsvector(), json_to_tsvector_byid(), jsonb_to_tsvector(), and jsonb_to_tsvector_byid().
bool pg_parse_json_or_errsave | ( | JsonLexContext * | lex, |
const JsonSemAction * | sem, | ||
struct Node * | escontext | ||
) |
Definition at line 518 of file jsonfuncs.c.
References json_errsave_error(), JSON_SUCCESS, pg_parse_json(), and sem.
Referenced by get_json_object_as_hash(), json_in(), jsonb_from_cstring(), and populate_array_json().
text* transform_json_string_values | ( | text * | json, |
void * | action_state, | ||
JsonTransformStringValuesAction | transform_action | ||
) |
Definition at line 5830 of file jsonfuncs.c.
References JsonSemAction::array_element_start, JsonSemAction::array_end, JsonSemAction::array_start, cstring_to_text_with_len(), freeJsonLexContext(), makeJsonLexContext(), makeStringInfo(), JsonSemAction::object_end, JsonSemAction::object_field_start, JsonSemAction::object_start, palloc0(), pg_parse_json_or_ereport, JsonSemAction::scalar, sem, JsonSemAction::semstate, transform_string_values_array_element_start(), transform_string_values_array_end(), transform_string_values_array_start(), transform_string_values_object_end(), transform_string_values_object_field_start(), transform_string_values_object_start(), and transform_string_values_scalar().
Referenced by ts_headline_json_byid_opt().
Jsonb* transform_jsonb_string_values | ( | Jsonb * | jsonb, |
void * | action_state, | ||
JsonTransformStringValuesAction | transform_action | ||
) |
Definition at line 5783 of file jsonfuncs.c.
References JsonbIterator::isScalar, jbvArray, jbvString, JsonbIteratorInit(), JsonbIteratorNext(), JsonbValueToJsonb(), pg_detoast_datum_packed(), pushJsonbValue(), res, Jsonb::root, type, JsonbValue::type, JsonbValue::val, VARDATA_ANY, VARSIZE_ANY_EXHDR, WJB_BEGIN_ARRAY, WJB_DONE, WJB_ELEM, WJB_KEY, and WJB_VALUE.
Referenced by ts_headline_jsonb_byid_opt().