PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <limits.h>
#include "access/htup_details.h"
#include "catalog/pg_type.h"
#include "common/int.h"
#include "common/jsonapi.h"
#include "common/string.h"
#include "fmgr.h"
#include "funcapi.h"
#include "lib/stringinfo.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "nodes/miscnodes.h"
#include "parser/parse_coerce.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/hsearch.h"
#include "utils/json.h"
#include "utils/jsonb.h"
#include "utils/jsonfuncs.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/syscache.h"
#include "utils/typcache.h"
Go to the source code of this file.
Data Structures | |
struct | OkeysState |
struct | IterateJsonStringValuesState |
struct | TransformJsonStringValuesState |
struct | GetState |
struct | AlenState |
struct | EachState |
struct | ElementsState |
struct | JHashState |
struct | JsonHashEntry |
struct | ScalarIOData |
struct | ArrayIOData |
struct | CompositeIOData |
struct | DomainIOData |
struct | ColumnIOData |
struct | RecordIOData |
struct | PopulateRecordCache |
struct | PopulateRecordsetState |
struct | PopulateArrayContext |
struct | PopulateArrayState |
struct | StripnullState |
struct | JsValue |
struct | JsObject |
Macros | |
#define | JB_PATH_CREATE 0x0001 |
#define | JB_PATH_DELETE 0x0002 |
#define | JB_PATH_REPLACE 0x0004 |
#define | JB_PATH_INSERT_BEFORE 0x0008 |
#define | JB_PATH_INSERT_AFTER 0x0010 |
#define | JB_PATH_CREATE_OR_INSERT (JB_PATH_INSERT_BEFORE | JB_PATH_INSERT_AFTER | JB_PATH_CREATE) |
#define | JB_PATH_FILL_GAPS 0x0020 |
#define | JB_PATH_CONSISTENT_POSITION 0x0040 |
#define | JsValueIsNull(jsv) |
#define | JsValueIsString(jsv) |
#define | JsObjectIsEmpty(jso) |
#define | JsObjectFree(jso) |
Enumerations | |
enum | TypeCat { TYPECAT_SCALAR = 's' , TYPECAT_ARRAY = 'a' , TYPECAT_COMPOSITE = 'c' , TYPECAT_COMPOSITE_DOMAIN = 'C' , TYPECAT_DOMAIN = 'd' } |
#define JB_PATH_CONSISTENT_POSITION 0x0040 |
Definition at line 52 of file jsonfuncs.c.
#define JB_PATH_CREATE 0x0001 |
Definition at line 44 of file jsonfuncs.c.
#define JB_PATH_CREATE_OR_INSERT (JB_PATH_INSERT_BEFORE | JB_PATH_INSERT_AFTER | JB_PATH_CREATE) |
Definition at line 49 of file jsonfuncs.c.
#define JB_PATH_DELETE 0x0002 |
Definition at line 45 of file jsonfuncs.c.
#define JB_PATH_FILL_GAPS 0x0020 |
Definition at line 51 of file jsonfuncs.c.
#define JB_PATH_INSERT_AFTER 0x0010 |
Definition at line 48 of file jsonfuncs.c.
#define JB_PATH_INSERT_BEFORE 0x0008 |
Definition at line 47 of file jsonfuncs.c.
#define JB_PATH_REPLACE 0x0004 |
Definition at line 46 of file jsonfuncs.c.
#define JsObjectFree | ( | jso | ) |
Definition at line 334 of file jsonfuncs.c.
#define JsObjectIsEmpty | ( | jso | ) |
Definition at line 328 of file jsonfuncs.c.
#define JsValueIsNull | ( | jsv | ) |
Definition at line 319 of file jsonfuncs.c.
#define JsValueIsString | ( | jsv | ) |
Definition at line 324 of file jsonfuncs.c.
typedef struct ArrayIOData ArrayIOData |
typedef struct ColumnIOData ColumnIOData |
Definition at line 1 of file jsonfuncs.c.
typedef struct CompositeIOData CompositeIOData |
typedef struct DomainIOData DomainIOData |
typedef struct ElementsState ElementsState |
typedef struct IterateJsonStringValuesState IterateJsonStringValuesState |
typedef struct JHashState JHashState |
typedef struct JsonHashEntry JsonHashEntry |
typedef struct OkeysState OkeysState |
typedef struct PopulateArrayContext PopulateArrayContext |
typedef struct PopulateArrayState PopulateArrayState |
typedef struct PopulateRecordCache PopulateRecordCache |
typedef struct PopulateRecordsetState PopulateRecordsetState |
typedef struct RecordIOData RecordIOData |
Definition at line 1 of file jsonfuncs.c.
typedef struct ScalarIOData ScalarIOData |
typedef struct StripnullState StripnullState |
typedef struct TransformJsonStringValuesState TransformJsonStringValuesState |
enum TypeCat |
Enumerator | |
---|---|
TYPECAT_SCALAR | |
TYPECAT_ARRAY | |
TYPECAT_COMPOSITE | |
TYPECAT_COMPOSITE_DOMAIN | |
TYPECAT_DOMAIN |
Definition at line 199 of file jsonfuncs.c.
|
static |
Definition at line 1927 of file jsonfuncs.c.
References AlenState::count, JSON_SUCCESS, AlenState::lex, and JsonLexContext::lex_level.
Referenced by json_array_length().
|
static |
Definition at line 1899 of file jsonfuncs.c.
References ereport, errcode(), errmsg(), ERROR, JSON_SUCCESS, AlenState::lex, and JsonLexContext::lex_level.
Referenced by json_array_length().
|
static |
Definition at line 1913 of file jsonfuncs.c.
References ereport, errcode(), errmsg(), ERROR, JSON_SUCCESS, AlenState::lex, and JsonLexContext::lex_level.
Referenced by json_array_length().
|
static |
Definition at line 3475 of file jsonfuncs.c.
References data, InvalidOid, MemoryContextAlloc(), and MemSet.
Referenced by populate_record().
|
static |
Definition at line 2167 of file jsonfuncs.c.
References ereport, errcode(), errmsg(), ERROR, JSON_SUCCESS, EachState::lex, and JsonLexContext::lex_level.
Referenced by each_worker().
|
static |
Definition at line 2119 of file jsonfuncs.c.
References cstring_to_text_with_len(), CStringGetTextDatum, heap_form_tuple(), JSON_SUCCESS, len, EachState::lex, JsonLexContext::lex_level, MemoryContextReset(), MemoryContextSwitchTo(), EachState::next_scalar, EachState::normalize_results, EachState::normalized_scalar, PointerGetDatum(), JsonLexContext::prev_token_terminator, EachState::result_start, EachState::ret_tdesc, EachState::tmp_cxt, EachState::tuple_store, tuplestore_puttuple(), val, and values.
Referenced by each_worker().
|
static |
Definition at line 2097 of file jsonfuncs.c.
References JSON_SUCCESS, JSON_TOKEN_STRING, EachState::lex, JsonLexContext::lex_level, EachState::next_scalar, EachState::normalize_results, EachState::result_start, JsonLexContext::token_start, and JsonLexContext::token_type.
Referenced by each_worker().
|
static |
Definition at line 2181 of file jsonfuncs.c.
References ereport, errcode(), errmsg(), ERROR, JSON_SUCCESS, EachState::lex, JsonLexContext::lex_level, EachState::next_scalar, EachState::normalized_scalar, and token.
Referenced by each_worker().
|
static |
Definition at line 2057 of file jsonfuncs.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, JsonSemAction::array_start, CurrentMemoryContext, each_array_start(), each_object_field_end(), each_object_field_start(), each_scalar(), freeJsonLexContext(), InitMaterializedSRF(), makeJsonLexContext(), MAT_SRF_BLESS, MemoryContextDelete(), JsonSemAction::object_field_end, JsonSemAction::object_field_start, palloc0(), PG_GETARG_TEXT_PP, pg_parse_json_or_ereport, PG_RETURN_NULL, FunctionCallInfoBaseData::resultinfo, JsonSemAction::scalar, sem, JsonSemAction::semstate, ReturnSetInfo::setDesc, and ReturnSetInfo::setResult.
Referenced by json_each(), and json_each_text().
|
static |
Definition at line 1973 of file jsonfuncs.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert, cstring_to_text_with_len(), CurrentMemoryContext, ereport, errcode(), errmsg(), ERROR, funcname, InitMaterializedSRF(), JB_ROOT_IS_OBJECT, jbvNull, JsonbIteratorInit(), JsonbIteratorNext(), JsonbValueAsText(), JsonbValueToJsonb(), sort-test::key, MAT_SRF_BLESS, MemoryContextDelete(), MemoryContextReset(), MemoryContextSwitchTo(), PG_GETARG_JSONB_P, PG_RETURN_NULL, PointerGetDatum(), FunctionCallInfoBaseData::resultinfo, Jsonb::root, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, tuplestore_putvalues(), JsonbValue::type, JsonbValue::val, val, values, WJB_DONE, and WJB_KEY.
Referenced by jsonb_each(), and jsonb_each_text().
|
static |
Definition at line 2371 of file jsonfuncs.c.
References cstring_to_text_with_len(), CStringGetTextDatum, heap_form_tuple(), JSON_SUCCESS, len, ElementsState::lex, JsonLexContext::lex_level, MemoryContextReset(), MemoryContextSwitchTo(), ElementsState::next_scalar, ElementsState::normalize_results, ElementsState::normalized_scalar, PointerGetDatum(), JsonLexContext::prev_token_terminator, ElementsState::result_start, ElementsState::ret_tdesc, ElementsState::tmp_cxt, ElementsState::tuple_store, tuplestore_puttuple(), val, and values.
Referenced by elements_worker().
|
static |
Definition at line 2349 of file jsonfuncs.c.
References JSON_SUCCESS, JSON_TOKEN_STRING, ElementsState::lex, JsonLexContext::lex_level, ElementsState::next_scalar, ElementsState::normalize_results, ElementsState::result_start, JsonLexContext::token_start, and JsonLexContext::token_type.
Referenced by elements_worker().
|
static |
Definition at line 2417 of file jsonfuncs.c.
References ereport, errcode(), errmsg(), ERROR, ElementsState::function_name, JSON_SUCCESS, ElementsState::lex, and JsonLexContext::lex_level.
Referenced by elements_worker().
|
static |
Definition at line 2432 of file jsonfuncs.c.
References ereport, errcode(), errmsg(), ERROR, ElementsState::function_name, JSON_SUCCESS, ElementsState::lex, JsonLexContext::lex_level, ElementsState::next_scalar, ElementsState::normalized_scalar, and token.
Referenced by elements_worker().
|
static |
Definition at line 2307 of file jsonfuncs.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, JsonSemAction::array_element_end, JsonSemAction::array_element_start, CurrentMemoryContext, elements_array_element_end(), elements_array_element_start(), elements_object_start(), elements_scalar(), freeJsonLexContext(), funcname, InitMaterializedSRF(), makeJsonLexContext(), MAT_SRF_BLESS, MAT_SRF_USE_EXPECTED_DESC, MemoryContextDelete(), JsonSemAction::object_start, palloc0(), PG_GETARG_TEXT_PP, pg_parse_json_or_ereport, PG_RETURN_NULL, FunctionCallInfoBaseData::resultinfo, JsonSemAction::scalar, sem, JsonSemAction::semstate, ReturnSetInfo::setDesc, and ReturnSetInfo::setResult.
Referenced by json_array_elements(), and json_array_elements_text().
|
static |
Definition at line 2219 of file jsonfuncs.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, CurrentMemoryContext, ereport, errcode(), errmsg(), ERROR, InitMaterializedSRF(), JB_ROOT_IS_ARRAY, JB_ROOT_IS_SCALAR, jbvNull, JsonbIteratorInit(), JsonbIteratorNext(), JsonbValueAsText(), JsonbValueToJsonb(), MAT_SRF_BLESS, MAT_SRF_USE_EXPECTED_DESC, MemoryContextDelete(), MemoryContextReset(), MemoryContextSwitchTo(), PG_GETARG_JSONB_P, PG_RETURN_NULL, PointerGetDatum(), FunctionCallInfoBaseData::resultinfo, Jsonb::root, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, tuplestore_putvalues(), JsonbValue::type, val, values, WJB_DONE, and WJB_ELEM.
Referenced by jsonb_array_elements(), and jsonb_array_elements_text().
|
static |
Definition at line 1400 of file jsonfuncs.c.
References GetState::array_cur_index, cstring_to_text_with_len(), JSON_SUCCESS, len, GetState::lex, JsonLexContext::lex_level, GetState::normalize_results, GetState::path_indexes, GetState::pathok, JsonLexContext::prev_token_terminator, GetState::result_start, start, and GetState::tresult.
Referenced by get_worker().
|
static |
Definition at line 1352 of file jsonfuncs.c.
References GetState::array_cur_index, JSON_SUCCESS, JSON_TOKEN_STRING, GetState::lex, JsonLexContext::lex_level, GetState::next_scalar, GetState::normalize_results, GetState::path_indexes, GetState::pathok, GetState::result_start, JsonLexContext::token_start, JsonLexContext::token_type, and GetState::tresult.
Referenced by get_worker().
|
static |
Definition at line 1334 of file jsonfuncs.c.
References cstring_to_text_with_len(), JSON_SUCCESS, len, GetState::lex, JsonLexContext::lex_level, GetState::npath, JsonLexContext::prev_token_terminator, GetState::result_start, start, and GetState::tresult.
Referenced by get_worker().
|
static |
Definition at line 1294 of file jsonfuncs.c.
References GetState::array_cur_index, error(), json_count_array_elements(), json_errsave_error(), JSON_SUCCESS, GetState::lex, JsonLexContext::lex_level, GetState::npath, GetState::path_indexes, GetState::result_start, and JsonLexContext::token_start.
Referenced by get_worker().
|
static |
Definition at line 3810 of file jsonfuncs.c.
References JsonSemAction::array_start, ctl, CurrentMemoryContext, freeJsonLexContext(), funcname, GetDatabaseEncoding(), hash_array_start(), HASH_CONTEXT, hash_create(), hash_destroy(), HASH_ELEM, hash_object_field_end(), hash_object_field_start(), hash_scalar(), HASH_STRINGS, len, makeJsonLexContextCstringLen(), NAMEDATALEN, JsonSemAction::object_field_end, JsonSemAction::object_field_start, palloc0(), pg_parse_json_or_errsave(), JsonSemAction::scalar, sem, and JsonSemAction::semstate.
Referenced by JsValueToJsObject().
|
static |
Definition at line 1499 of file jsonfuncs.c.
References array_contains_nulls(), deconstruct_array_builtin(), jsonb_get_element(), PG_GETARG_ARRAYTYPE_P, PG_GETARG_JSONB_P, PG_RETURN_DATUM, PG_RETURN_NULL, and res.
Referenced by jsonb_extract_path(), and jsonb_extract_path_text().
|
static |
Definition at line 1178 of file jsonfuncs.c.
References cstring_to_text_with_len(), JSON_SUCCESS, len, GetState::lex, JsonLexContext::lex_level, GetState::npath, JsonLexContext::prev_token_terminator, GetState::result_start, start, and GetState::tresult.
Referenced by get_worker().
|
static |
Definition at line 1243 of file jsonfuncs.c.
References cstring_to_text_with_len(), JSON_SUCCESS, len, GetState::lex, JsonLexContext::lex_level, GetState::normalize_results, GetState::path_names, GetState::pathok, JsonLexContext::prev_token_terminator, GetState::result_start, start, and GetState::tresult.
Referenced by get_worker().
|
static |
Definition at line 1196 of file jsonfuncs.c.
References JSON_SUCCESS, JSON_TOKEN_STRING, GetState::lex, JsonLexContext::lex_level, GetState::next_scalar, GetState::normalize_results, GetState::path_names, GetState::pathok, GetState::result_start, JsonLexContext::token_start, JsonLexContext::token_type, and GetState::tresult.
Referenced by get_worker().
|
static |
Definition at line 1159 of file jsonfuncs.c.
References JSON_SUCCESS, GetState::lex, JsonLexContext::lex_level, GetState::npath, GetState::result_start, and JsonLexContext::token_start.
Referenced by get_worker().
|
static |
Definition at line 1023 of file jsonfuncs.c.
References array_contains_nulls(), Assert, deconstruct_array_builtin(), get_worker(), i, palloc(), PG_GETARG_ARRAYTYPE_P, PG_GETARG_TEXT_PP, PG_RETURN_NULL, PG_RETURN_TEXT_P, strtoint(), and TextDatumGetCString.
Referenced by json_extract_path(), and json_extract_path_text().
|
static |
Definition at line 3635 of file jsonfuncs.c.
References PopulateRecordCache::argtype, PopulateRecordCache::c, ereport, errcode(), errmsg(), ERROR, FunctionCallInfoBaseData::flinfo, PopulateRecordCache::fn_mcxt, funcname, get_fn_expr_argtype(), prepare_column_cache(), ColumnIOData::typcat, TYPECAT_COMPOSITE, and TYPECAT_COMPOSITE_DOMAIN.
Referenced by populate_record_worker(), and populate_recordset_worker().
|
static |
Definition at line 3661 of file jsonfuncs.c.
References PopulateRecordCache::argtype, Assert, CompositeIOData::base_typid, CompositeIOData::base_typmod, PopulateRecordCache::c, ColumnIOData::composite, CreateTupleDescCopy(), ereport, errcode(), errhint(), errmsg(), ERROR, PopulateRecordCache::fn_mcxt, FreeTupleDesc(), funcname, get_call_result_type(), ColumnIOData::io, MemoryContextSwitchTo(), TupleDescData::tdtypeid, TupleDescData::tdtypmod, CompositeIOData::tupdesc, and TYPEFUNC_COMPOSITE.
Referenced by populate_record_worker(), and populate_recordset_worker().
|
static |
Definition at line 1444 of file jsonfuncs.c.
References cstring_to_text(), cstring_to_text_with_len(), JsonLexContext::input, JSON_SUCCESS, JSON_TOKEN_NULL, JSON_TOKEN_STRING, len, GetState::lex, JsonLexContext::lex_level, GetState::next_scalar, GetState::normalize_results, GetState::npath, JsonLexContext::prev_token_terminator, start, token, and GetState::tresult.
Referenced by get_worker().
|
static |
Definition at line 1102 of file jsonfuncs.c.
References JsonSemAction::array_element_end, JsonSemAction::array_element_start, JsonSemAction::array_end, JsonSemAction::array_start, Assert, freeJsonLexContext(), get_array_element_end(), get_array_element_start(), get_array_end(), get_array_start(), get_object_end(), get_object_field_end(), get_object_field_start(), get_object_start(), get_scalar(), makeJsonLexContext(), JsonSemAction::object_end, JsonSemAction::object_field_end, JsonSemAction::object_field_start, JsonSemAction::object_start, palloc(), palloc0(), pg_parse_json_or_ereport, JsonSemAction::scalar, sem, and JsonSemAction::semstate.
Referenced by get_path_all(), json_array_element(), json_array_element_text(), json_object_field(), and json_object_field_text().
|
static |
Definition at line 3929 of file jsonfuncs.c.
References ereport, errcode(), errmsg(), ERROR, JHashState::function_name, JSON_SUCCESS, JHashState::lex, and JsonLexContext::lex_level.
Referenced by get_json_object_as_hash().
|
static |
Definition at line 3878 of file jsonfuncs.c.
References Assert, JHashState::hash, HASH_ENTER, hash_search(), JSON_SUCCESS, JSON_TOKEN_NULL, len, JHashState::lex, JsonLexContext::lex_level, NAMEDATALEN, palloc(), JsonLexContext::prev_token_terminator, JHashState::save_json_start, JHashState::saved_scalar, JHashState::saved_token_type, JsonHashEntry::type, JsonHashEntry::val, and val.
Referenced by get_json_object_as_hash().
|
static |
Definition at line 3852 of file jsonfuncs.c.
References JSON_SUCCESS, JSON_TOKEN_ARRAY_START, JSON_TOKEN_OBJECT_START, JHashState::lex, JsonLexContext::lex_level, JHashState::save_json_start, JHashState::saved_token_type, JsonLexContext::token_start, and JsonLexContext::token_type.
Referenced by get_json_object_as_hash().
|
static |
Definition at line 3942 of file jsonfuncs.c.
References Assert, ereport, errcode(), errmsg(), ERROR, JHashState::function_name, JSON_SUCCESS, JHashState::lex, JsonLexContext::lex_level, JHashState::saved_scalar, JHashState::saved_token_type, and token.
Referenced by get_json_object_as_hash().
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().
|
static |
Definition at line 5762 of file jsonfuncs.c.
References IterateJsonStringValuesState::action, IterateJsonStringValuesState::action_state, IterateJsonStringValuesState::flags, JSON_SUCCESS, jtiKey, pstrdup(), and val.
Referenced by iterate_json_values().
|
static |
Definition at line 5734 of file jsonfuncs.c.
References IterateJsonStringValuesState::action, IterateJsonStringValuesState::action_state, IterateJsonStringValuesState::flags, JSON_SUCCESS, JSON_TOKEN_FALSE, JSON_TOKEN_NUMBER, JSON_TOKEN_STRING, JSON_TOKEN_TRUE, jtiBool, jtiNumeric, jtiString, and token.
Referenced by iterate_json_values().
|
static |
Definition at line 5053 of file jsonfuncs.c.
References Assert, JsonbIteratorNext(), pushJsonbValue(), res, WJB_BEGIN_ARRAY, WJB_BEGIN_OBJECT, WJB_DONE, WJB_ELEM, WJB_END_ARRAY, and WJB_END_OBJECT.
Referenced by jsonb_concat().
Definition at line 3491 of file jsonfuncs.c.
References getKeyJsonValueFromContainer(), HASH_FIND, hash_search(), JsValue::is_json, JsObject::is_json, JsValue::json, JsObject::json_hash, JSON_TOKEN_NULL, JsValue::jsonb, JsObject::jsonb_cont, JsonHashEntry::type, JsonHashEntry::val, JsValue::val, and JsObject::val.
Referenced by populate_record().
Datum json_array_element | ( | PG_FUNCTION_ARGS | ) |
Definition at line 921 of file jsonfuncs.c.
References element(), get_worker(), PG_GETARG_INT32, PG_GETARG_TEXT_PP, PG_RETURN_NULL, and PG_RETURN_TEXT_P.
Datum json_array_element_text | ( | PG_FUNCTION_ARGS | ) |
Definition at line 964 of file jsonfuncs.c.
References element(), get_worker(), PG_GETARG_INT32, PG_GETARG_TEXT_PP, PG_RETURN_NULL, and PG_RETURN_TEXT_P.
Datum json_array_elements | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2295 of file jsonfuncs.c.
References elements_worker().
Datum json_array_elements_text | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2301 of file jsonfuncs.c.
References elements_worker().
Datum json_array_length | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1851 of file jsonfuncs.c.
References alen_array_element_start(), alen_object_start(), alen_scalar(), JsonSemAction::array_element_start, makeJsonLexContext(), JsonSemAction::object_start, palloc0(), PG_GETARG_TEXT_PP, pg_parse_json_or_ereport, PG_RETURN_INT32, JsonSemAction::scalar, sem, and JsonSemAction::semstate.
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().
Datum json_each | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1949 of file jsonfuncs.c.
References each_worker().
Datum json_each_text | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1961 of file jsonfuncs.c.
References each_worker().
void json_errsave_error | ( | JsonParseErrorType | error, |
JsonLexContext * | lex, | ||
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().
Datum json_extract_path | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1008 of file jsonfuncs.c.
References get_path_all().
Datum json_extract_path_text | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1014 of file jsonfuncs.c.
References get_path_all().
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_object_field | ( | PG_FUNCTION_ARGS | ) |
Definition at line 845 of file jsonfuncs.c.
References get_worker(), PG_GETARG_TEXT_PP, PG_RETURN_NULL, PG_RETURN_TEXT_P, and text_to_cstring().
Datum json_object_field_text | ( | PG_FUNCTION_ARGS | ) |
Definition at line 883 of file jsonfuncs.c.
References get_worker(), PG_GETARG_TEXT_PP, PG_RETURN_NULL, PG_RETURN_TEXT_P, and text_to_cstring().
Datum json_object_keys | ( | PG_FUNCTION_ARGS | ) |
Definition at line 731 of file jsonfuncs.c.
References JsonSemAction::array_start, CStringGetTextDatum, freeJsonLexContext(), if(), makeJsonLexContext(), MemoryContextSwitchTo(), FuncCallContext::multi_call_memory_ctx, JsonSemAction::object_field_start, okeys_array_start(), okeys_object_field_start(), okeys_scalar(), palloc(), palloc0(), pfree(), PG_GETARG_TEXT_PP, pg_parse_json_or_ereport, JsonSemAction::scalar, sem, JsonSemAction::semstate, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, and FuncCallContext::user_fctx.
Datum json_populate_record | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2494 of file jsonfuncs.c.
References populate_record_worker().
Datum json_populate_recordset | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3987 of file jsonfuncs.c.
References populate_recordset_worker().
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().
Datum json_strip_nulls | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4493 of file jsonfuncs.c.
References JsonSemAction::array_element_start, JsonSemAction::array_end, JsonSemAction::array_start, cstring_to_text_with_len(), makeJsonLexContext(), makeStringInfo(), JsonSemAction::object_end, JsonSemAction::object_field_start, JsonSemAction::object_start, palloc0(), PG_GETARG_TEXT_PP, pg_parse_json_or_ereport, PG_RETURN_TEXT_P, JsonSemAction::scalar, sem, JsonSemAction::semstate, sn_array_element_start(), sn_array_end(), sn_array_start(), sn_object_end(), sn_object_field_start(), sn_object_start(), and sn_scalar().
Datum json_to_record | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2501 of file jsonfuncs.c.
References populate_record_worker().
Datum json_to_recordset | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3994 of file jsonfuncs.c.
References populate_recordset_worker().
Datum jsonb_array_element | ( | PG_FUNCTION_ARGS | ) |
Definition at line 936 of file jsonfuncs.c.
References element(), getIthJsonbValueFromContainer(), JB_ROOT_COUNT, JB_ROOT_IS_ARRAY, JsonbValueToJsonb(), pg_abs_s32(), PG_GETARG_INT32, PG_GETARG_JSONB_P, PG_RETURN_JSONB_P, PG_RETURN_NULL, and Jsonb::root.
Datum jsonb_array_element_text | ( | PG_FUNCTION_ARGS | ) |
Definition at line 979 of file jsonfuncs.c.
References element(), getIthJsonbValueFromContainer(), JB_ROOT_COUNT, JB_ROOT_IS_ARRAY, jbvNull, JsonbValueAsText(), pg_abs_s32(), PG_GETARG_INT32, PG_GETARG_JSONB_P, PG_RETURN_NULL, PG_RETURN_TEXT_P, Jsonb::root, and JsonbValue::type.
Datum jsonb_array_elements | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2207 of file jsonfuncs.c.
References elements_worker_jsonb().
Datum jsonb_array_elements_text | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2213 of file jsonfuncs.c.
References elements_worker_jsonb().
Datum jsonb_array_length | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1877 of file jsonfuncs.c.
References ereport, errcode(), errmsg(), ERROR, JB_ROOT_COUNT, JB_ROOT_IS_ARRAY, JB_ROOT_IS_SCALAR, PG_GETARG_JSONB_P, and PG_RETURN_INT32.
Datum jsonb_concat | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4600 of file jsonfuncs.c.
References Assert, IteratorConcat(), JB_ROOT_COUNT, JB_ROOT_IS_OBJECT, JB_ROOT_IS_SCALAR, JsonbIteratorInit(), JsonbValueToJsonb(), PG_GETARG_JSONB_P, PG_RETURN_JSONB_P, res, and Jsonb::root.
Datum jsonb_delete | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4641 of file jsonfuncs.c.
References Assert, ereport, errcode(), errmsg(), ERROR, JB_ROOT_COUNT, JB_ROOT_IS_SCALAR, jbvString, JsonbIteratorInit(), JsonbIteratorNext(), JsonbValueToJsonb(), sort-test::key, PG_GETARG_JSONB_P, PG_GETARG_TEXT_PP, PG_RETURN_JSONB_P, pushJsonbValue(), res, Jsonb::root, JsonbValue::type, JsonbValue::val, VARDATA_ANY, VARSIZE_ANY_EXHDR, WJB_BEGIN_ARRAY, WJB_DONE, WJB_ELEM, and WJB_KEY.
Datum jsonb_delete_array | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4694 of file jsonfuncs.c.
References ARR_NDIM, Assert, deconstruct_array_builtin(), ereport, errcode(), errmsg(), ERROR, i, JB_ROOT_COUNT, JB_ROOT_IS_SCALAR, jbvString, JsonbIteratorInit(), JsonbIteratorNext(), JsonbValueToJsonb(), PG_GETARG_ARRAYTYPE_P, PG_GETARG_JSONB_P, PG_RETURN_JSONB_P, pushJsonbValue(), res, Jsonb::root, JsonbValue::type, JsonbValue::val, VARDATA_ANY, VARSIZE_ANY_EXHDR, WJB_BEGIN_ARRAY, WJB_DONE, WJB_ELEM, and WJB_KEY.
Datum jsonb_delete_idx | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4781 of file jsonfuncs.c.
References Assert, ereport, errcode(), errmsg(), ERROR, i, idx(), JB_ROOT_COUNT, JB_ROOT_IS_OBJECT, JB_ROOT_IS_SCALAR, JsonbIteratorInit(), JsonbIteratorNext(), JsonbValueToJsonb(), pg_abs_s32(), PG_GETARG_INT32, PG_GETARG_JSONB_P, PG_RETURN_JSONB_P, pushJsonbValue(), res, Jsonb::root, JsonbValue::val, WJB_BEGIN_ARRAY, WJB_DONE, and WJB_ELEM.
Datum jsonb_delete_path | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4961 of file jsonfuncs.c.
References ARR_NDIM, Assert, deconstruct_array_builtin(), ereport, errcode(), errmsg(), ERROR, JB_PATH_DELETE, JB_ROOT_COUNT, JB_ROOT_IS_SCALAR, JsonbIteratorInit(), JsonbValueToJsonb(), PG_GETARG_ARRAYTYPE_P, PG_GETARG_JSONB_P, PG_RETURN_JSONB_P, res, Jsonb::root, and setPath().
Referenced by jsonb_set_lax().
Datum jsonb_each | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1955 of file jsonfuncs.c.
References each_worker_jsonb().
Datum jsonb_each_text | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1967 of file jsonfuncs.c.
References each_worker_jsonb().
Datum jsonb_extract_path | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1487 of file jsonfuncs.c.
References get_jsonb_path_all().
Datum jsonb_extract_path_text | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1493 of file jsonfuncs.c.
References get_jsonb_path_all().
Definition at line 1530 of file jsonfuncs.c.
References Assert, cstring_to_text(), DatumGetTextPP, elog, ERROR, getIthJsonbValueFromContainer(), getKeyJsonValueFromContainer(), i, IsAJsonbScalar, JB_ROOT_IS_ARRAY, JB_ROOT_IS_OBJECT, JB_ROOT_IS_SCALAR, jbvBinary, jbvNull, JsonbToCString(), JsonbValueAsText(), JsonbValueToJsonb(), JsonContainerIsArray, JsonContainerIsObject, JsonContainerIsScalar, JsonContainerSize, PG_RETURN_JSONB_P, PointerGetDatum(), res, Jsonb::root, strtoint(), TextDatumGetCString, JsonbValue::type, JsonbValue::val, VARDATA_ANY, VARSIZE, and VARSIZE_ANY_EXHDR.
Referenced by get_jsonb_path_all(), jsonb_subscript_fetch(), and jsonb_subscript_fetch_old().
Datum jsonb_insert | ( | PG_FUNCTION_ARGS | ) |
Definition at line 5004 of file jsonfuncs.c.
References ARR_NDIM, Assert, deconstruct_array_builtin(), ereport, errcode(), errmsg(), ERROR, JB_PATH_INSERT_AFTER, JB_PATH_INSERT_BEFORE, JB_ROOT_IS_SCALAR, JsonbIteratorInit(), JsonbToJsonbValue(), JsonbValueToJsonb(), newval, PG_GETARG_ARRAYTYPE_P, PG_GETARG_BOOL, PG_GETARG_JSONB_P, PG_RETURN_JSONB_P, res, Jsonb::root, and setPath().
Datum jsonb_object_field | ( | PG_FUNCTION_ARGS | ) |
Definition at line 861 of file jsonfuncs.c.
References getKeyJsonValueFromContainer(), JB_ROOT_IS_OBJECT, JsonbValueToJsonb(), sort-test::key, PG_GETARG_JSONB_P, PG_GETARG_TEXT_PP, PG_RETURN_JSONB_P, PG_RETURN_NULL, Jsonb::root, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Datum jsonb_object_field_text | ( | PG_FUNCTION_ARGS | ) |
Definition at line 899 of file jsonfuncs.c.
References getKeyJsonValueFromContainer(), JB_ROOT_IS_OBJECT, jbvNull, JsonbValueAsText(), sort-test::key, PG_GETARG_JSONB_P, PG_GETARG_TEXT_PP, PG_RETURN_NULL, PG_RETURN_TEXT_P, Jsonb::root, JsonbValue::type, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Datum jsonb_object_keys | ( | PG_FUNCTION_ARGS | ) |
Definition at line 567 of file jsonfuncs.c.
References CStringGetTextDatum, ereport, errcode(), errmsg(), ERROR, if(), JB_ROOT_COUNT, JB_ROOT_IS_ARRAY, JB_ROOT_IS_SCALAR, JsonbIteratorInit(), JsonbIteratorNext(), MemoryContextSwitchTo(), FuncCallContext::multi_call_memory_ctx, palloc(), PG_GETARG_JSONB_P, Jsonb::root, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, FuncCallContext::user_fctx, JsonbValue::val, WJB_DONE, and WJB_KEY.
Datum jsonb_populate_record | ( | PG_FUNCTION_ARGS | ) |
Datum jsonb_populate_record_valid | ( | PG_FUNCTION_ARGS | ) |
Definition at line 2476 of file jsonfuncs.c.
References BoolGetDatum(), ErrorSaveContext::error_occurred, and populate_record_worker().
Datum jsonb_populate_recordset | ( | PG_FUNCTION_ARGS | ) |
Datum jsonb_pretty | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4584 of file jsonfuncs.c.
References cstring_to_text_with_len(), JsonbToCStringIndent(), makeStringInfo(), PG_GETARG_JSONB_P, PG_RETURN_TEXT_P, Jsonb::root, str, and VARSIZE.
Datum jsonb_set | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4845 of file jsonfuncs.c.
References ARR_NDIM, Assert, deconstruct_array_builtin(), ereport, errcode(), errmsg(), ERROR, JB_PATH_CREATE, JB_PATH_REPLACE, JB_ROOT_COUNT, JB_ROOT_IS_SCALAR, JsonbIteratorInit(), JsonbToJsonbValue(), JsonbValueToJsonb(), newval, PG_GETARG_ARRAYTYPE_P, PG_GETARG_BOOL, PG_GETARG_JSONB_P, PG_RETURN_JSONB_P, res, Jsonb::root, and setPath().
Referenced by jsonb_set_lax().
Datum jsonb_set_element | ( | Jsonb * | jb, |
Datum * | path, | ||
int | path_len, | ||
JsonbValue * | newval | ||
) |
Definition at line 1678 of file jsonfuncs.c.
References JB_PATH_CONSISTENT_POSITION, JB_PATH_CREATE, JB_PATH_FILL_GAPS, jbvArray, JsonbIteratorInit(), JsonbValueToJsonb(), newval, palloc0(), pfree(), PG_RETURN_JSONB_P, res, Jsonb::root, and setPath().
Referenced by jsonb_subscript_assign().
Datum jsonb_set_lax | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4894 of file jsonfuncs.c.
References CStringGetDatum(), DirectFunctionCall1, ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, jsonb_delete_path(), jsonb_in(), jsonb_set(), newval, PG_ARGISNULL, PG_GETARG_JSONB_P, PG_GETARG_TEXT_P, PG_RETURN_JSONB_P, PG_RETURN_NULL, and text_to_cstring().
Datum jsonb_strip_nulls | ( | PG_FUNCTION_ARGS | ) |
Definition at line 4526 of file jsonfuncs.c.
References Assert, JB_ROOT_IS_SCALAR, jbvNull, JsonbIteratorInit(), JsonbIteratorNext(), JsonbValueToJsonb(), PG_GETARG_JSONB_P, PG_RETURN_POINTER, pushJsonbValue(), res, Jsonb::root, type, JsonbValue::type, WJB_DONE, WJB_ELEM, WJB_KEY, and WJB_VALUE.
Datum jsonb_to_record | ( | PG_FUNCTION_ARGS | ) |
Datum jsonb_to_recordset | ( | PG_FUNCTION_ARGS | ) |
|
static |
Definition at line 1804 of file jsonfuncs.c.
References cstring_to_text(), cstring_to_text_with_len(), StringInfoData::data, DatumGetCString(), DirectFunctionCall1, elog, ERROR, initStringInfo(), jbvBinary, jbvBool, jbvNull, jbvNumeric, jbvString, JsonbToCString(), StringInfoData::len, numeric_out(), PointerGetDatum(), JsonbValue::type, and JsonbValue::val.
Referenced by each_worker_jsonb(), elements_worker_jsonb(), jsonb_array_element_text(), jsonb_get_element(), and jsonb_object_field_text().
Definition at line 2981 of file jsonfuncs.c.
References Assert, errcode(), errmsg(), errsave, get_json_object_as_hash(), JsValue::is_json, JsObject::is_json, IsAJsonbScalar, jbvBinary, JsValue::json, JsObject::json_hash, JsValue::jsonb, JsObject::jsonb_cont, JsonContainerIsObject, JsonContainerIsScalar, SOFT_ERROR_OCCURRED, JsonbValue::type, JsValue::val, JsObject::val, and JsonbValue::val.
Referenced by populate_composite().
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().
|
static |
Definition at line 808 of file jsonfuncs.c.
References ereport, errcode(), errmsg(), ERROR, JSON_SUCCESS, OkeysState::lex, and JsonLexContext::lex_level.
Referenced by json_object_keys().
|
static |
Definition at line 785 of file jsonfuncs.c.
References JSON_SUCCESS, OkeysState::lex, JsonLexContext::lex_level, pstrdup(), repalloc(), OkeysState::result, OkeysState::result_count, and OkeysState::result_size.
Referenced by json_object_keys().
|
static |
Definition at line 823 of file jsonfuncs.c.
References ereport, errcode(), errmsg(), ERROR, JSON_SUCCESS, OkeysState::lex, and JsonLexContext::lex_level.
Referenced by json_object_keys().
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, | ||
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().
|
static |
Definition at line 2914 of file jsonfuncs.c.
References PopulateArrayContext::acxt, PopulateArrayContext::aio, Assert, PopulateArrayContext::astate, PopulateArrayContext::colname, CurrentMemoryContext, PopulateArrayContext::dims, ArrayIOData::element_type, PopulateArrayContext::escontext, i, initArrayResult(), JsValue::is_json, JsValue::json, JsValue::jsonb, makeMdArrayResult(), PopulateArrayContext::mcxt, PopulateArrayContext::ndims, palloc(), pfree(), populate_array_dim_jsonb(), populate_array_json(), PopulateArrayContext::sizes, and JsValue::val.
Referenced by populate_record_field().
|
static |
Definition at line 2667 of file jsonfuncs.c.
References JSON_SEM_ACTION_FAILED, JSON_SUCCESS, PopulateArrayContext::ndims, populate_array_assign_ndims(), and populate_array_check_dimension().
Referenced by populate_array_json().
|
static |
Definition at line 2559 of file jsonfuncs.c.
References Assert, PopulateArrayContext::dims, PopulateArrayContext::escontext, i, PopulateArrayContext::ndims, palloc(), palloc0(), populate_array_report_expected_array(), PopulateArrayContext::sizes, and SOFT_ERROR_OCCURRED.
Referenced by populate_array_array_end(), populate_array_dim_jsonb(), populate_array_object_start(), and populate_array_scalar().
|
static |
Definition at line 2589 of file jsonfuncs.c.
References PopulateArrayContext::dims, ereturn, errcode(), errdetail(), errmsg(), PopulateArrayContext::escontext, and PopulateArrayContext::sizes.
Referenced by populate_array_array_end(), and populate_array_dim_jsonb().
|
static |
Definition at line 2824 of file jsonfuncs.c.
References Assert, check_stack_depth(), PopulateArrayContext::dims, PopulateArrayContext::escontext, JsValue::is_json, jbvBinary, JsValue::jsonb, JsonbIteratorInit(), JsonbIteratorNext(), JsonContainerIsArray, JsonContainerIsScalar, PopulateArrayContext::ndims, populate_array_assign_ndims(), populate_array_check_dimension(), populate_array_element(), populate_array_report_expected_array(), SOFT_ERROR_OCCURRED, JsonbValue::type, JsValue::val, JsonbValue::val, val, WJB_BEGIN_ARRAY, WJB_DONE, WJB_ELEM, and WJB_END_ARRAY.
Referenced by populate_array().
|
static |
Definition at line 2617 of file jsonfuncs.c.
References accumArrayResult(), PopulateArrayContext::acxt, PopulateArrayContext::aio, Assert, PopulateArrayContext::astate, element(), ArrayIOData::element_info, ArrayIOData::element_type, ArrayIOData::element_typmod, PopulateArrayContext::escontext, PopulateArrayContext::mcxt, PointerGetDatum(), populate_record_field(), PopulateArrayContext::sizes, and SOFT_ERROR_OCCURRED.
Referenced by populate_array_dim_jsonb(), and populate_array_element_end().
|
static |
Definition at line 2709 of file jsonfuncs.c.
References Assert, JsValue::is_json, JsValue::json, JSON_SEM_ACTION_FAILED, JSON_SUCCESS, JSON_TOKEN_NULL, PopulateArrayContext::ndims, populate_array_element(), and JsValue::val.
Referenced by populate_array_json().
|
static |
Definition at line 2691 of file jsonfuncs.c.
References JSON_SUCCESS.
Referenced by populate_array_json().
|
static |
Definition at line 2788 of file jsonfuncs.c.
References JsonSemAction::array_element_end, JsonSemAction::array_element_start, JsonSemAction::array_end, Assert, PopulateArrayContext::dims, PopulateArrayContext::escontext, freeJsonLexContext(), GetDatabaseEncoding(), len, makeJsonLexContextCstringLen(), PopulateArrayContext::ndims, JsonSemAction::object_start, pg_parse_json_or_errsave(), populate_array_array_end(), populate_array_element_end(), populate_array_element_start(), populate_array_object_start(), populate_array_scalar(), JsonSemAction::scalar, sem, JsonSemAction::semstate, and SOFT_ERROR_OCCURRED.
Referenced by populate_array().
|
static |
Definition at line 2644 of file jsonfuncs.c.
References Assert, JSON_SEM_ACTION_FAILED, JSON_SUCCESS, populate_array_assign_ndims(), populate_array_report_expected_array(), and SOFT_ERROR_OCCURRED.
Referenced by populate_array_json().
|
static |
Definition at line 2509 of file jsonfuncs.c.
References appendStringInfo(), Assert, PopulateArrayContext::colname, StringInfoData::data, errcode(), errhint(), errmsg(), errsave, PopulateArrayContext::escontext, i, initStringInfo(), PopulateArrayContext::ndims, and PopulateArrayContext::sizes.
Referenced by populate_array_assign_ndims(), populate_array_dim_jsonb(), populate_array_object_start(), and populate_array_scalar().
|
static |
Definition at line 2752 of file jsonfuncs.c.
References Assert, PopulateArrayContext::escontext, JSON_SEM_ACTION_FAILED, JSON_SUCCESS, PopulateArrayContext::ndims, populate_array_assign_ndims(), populate_array_report_expected_array(), SOFT_ERROR_OCCURRED, and token.
Referenced by populate_array_json().
|
static |
Definition at line 3057 of file jsonfuncs.c.
References CompositeIOData::base_typid, domain_check_safe(), CompositeIOData::domain_info, HeapTupleHeaderGetDatum(), JsObjectFree, JsValueToJsObject(), populate_record(), CompositeIOData::record_io, SOFT_ERROR_OCCURRED, CompositeIOData::tupdesc, and update_cached_tupdesc().
Referenced by populate_record_field(), and populate_record_worker().
|
static |
Definition at line 3216 of file jsonfuncs.c.
References Assert, DomainIOData::base_io, DomainIOData::base_typid, DomainIOData::base_typmod, domain_check_safe(), DomainIOData::domain_info, PointerGetDatum(), populate_record_field(), res, and SOFT_ERROR_OCCURRED.
Referenced by populate_record_field().
|
static |
Definition at line 3519 of file jsonfuncs.c.
References allocate_record_info(), RecordIOData::columns, heap_deform_tuple(), heap_form_tuple(), HeapTupleHeaderGetDatumLength, i, InvalidOid, ItemPointerSetInvalid(), JsObjectGetField(), JsObjectIsEmpty, MemSet, NameStr, TupleDescData::natts, RecordIOData::ncolumns, palloc(), pfree(), populate_record_field(), RecordIOData::record_type, RecordIOData::record_typmod, res, HeapTupleData::t_data, HeapTupleData::t_len, HeapTupleData::t_self, HeapTupleData::t_tableOid, TupleDescData::tdtypeid, TupleDescData::tdtypmod, TupleDescAttr, and values.
Referenced by populate_composite(), and populate_recordset_record().
|
static |
Definition at line 3405 of file jsonfuncs.c.
References ColumnIOData::array, check_stack_depth(), ColumnIOData::composite, DatumGetHeapTupleHeader, DatumGetPointer(), ColumnIOData::domain, elog, ERROR, ColumnIOData::io, JsValueIsNull, JsValueIsString, populate_array(), populate_composite(), populate_domain(), populate_scalar(), prepare_column_cache(), ColumnIOData::scalar_io, ColumnIOData::typcat, TYPECAT_ARRAY, TYPECAT_COMPOSITE, TYPECAT_COMPOSITE_DOMAIN, TYPECAT_DOMAIN, TYPECAT_SCALAR, ColumnIOData::typid, and ColumnIOData::typmod.
Referenced by json_populate_type(), populate_array_element(), populate_domain(), and populate_record().
|
static |
Definition at line 3698 of file jsonfuncs.c.
References PopulateRecordCache::argtype, Assert, CompositeIOData::base_typid, CompositeIOData::base_typmod, PopulateRecordCache::c, ColumnIOData::composite, FunctionCallInfoBaseData::flinfo, FmgrInfo::fn_extra, PopulateRecordCache::fn_mcxt, FmgrInfo::fn_mcxt, funcname, get_record_type_from_argument(), get_record_type_from_query(), HeapTupleHeaderGetTypeId, HeapTupleHeaderGetTypMod, ColumnIOData::io, JsValue::is_json, jbvBinary, JsValue::json, JSON_TOKEN_INVALID, JsValue::jsonb, MemoryContextAllocZero(), PG_ARGISNULL, PG_GETARG_HEAPTUPLEHEADER, PG_GETARG_JSONB_P, PG_GETARG_TEXT_PP, PG_RETURN_DATUM, PG_RETURN_NULL, PG_RETURN_POINTER, populate_composite(), Jsonb::root, SOFT_ERROR_OCCURRED, JsonbValue::type, JsValue::val, JsonbValue::val, VARDATA_ANY, VARHDRSZ, VARSIZE, and VARSIZE_ANY_EXHDR.
Referenced by json_populate_record(), json_to_record(), jsonb_populate_record(), jsonb_populate_record_valid(), and jsonb_to_record().
|
static |
Definition at line 4267 of file jsonfuncs.c.
References ereport, errcode(), errmsg(), ERROR, PopulateRecordsetState::function_name, JSON_SUCCESS, JSON_TOKEN_OBJECT_START, PopulateRecordsetState::lex, JsonLexContext::lex_level, and JsonLexContext::token_type.
Referenced by populate_recordset_worker().
|
static |
Definition at line 4282 of file jsonfuncs.c.
References JSON_SUCCESS.
Referenced by populate_recordset_worker().
|
static |
Definition at line 4244 of file jsonfuncs.c.
References hash_destroy(), JsObject::is_json, PopulateRecordsetState::json_hash, JsObject::json_hash, JSON_SUCCESS, PopulateRecordsetState::lex, JsonLexContext::lex_level, populate_recordset_record(), and JsObject::val.
Referenced by populate_recordset_worker().
|
static |
Definition at line 4329 of file jsonfuncs.c.
References Assert, HASH_ENTER, hash_search(), PopulateRecordsetState::json_hash, JSON_SUCCESS, JSON_TOKEN_NULL, len, PopulateRecordsetState::lex, JsonLexContext::lex_level, NAMEDATALEN, palloc(), JsonLexContext::prev_token_terminator, PopulateRecordsetState::save_json_start, PopulateRecordsetState::saved_scalar, PopulateRecordsetState::saved_token_type, JsonHashEntry::type, JsonHashEntry::val, and val.
Referenced by populate_recordset_worker().
|
static |
Definition at line 4306 of file jsonfuncs.c.
References JSON_SUCCESS, JSON_TOKEN_ARRAY_START, JSON_TOKEN_OBJECT_START, PopulateRecordsetState::lex, JsonLexContext::lex_level, PopulateRecordsetState::save_json_start, PopulateRecordsetState::saved_token_type, JsonLexContext::token_start, and JsonLexContext::token_type.
Referenced by populate_recordset_worker().
|
static |
Definition at line 4214 of file jsonfuncs.c.
References ctl, CurrentMemoryContext, ereport, errcode(), errmsg(), ERROR, PopulateRecordsetState::function_name, HASH_CONTEXT, hash_create(), HASH_ELEM, HASH_STRINGS, PopulateRecordsetState::json_hash, JSON_SUCCESS, PopulateRecordsetState::lex, JsonLexContext::lex_level, and NAMEDATALEN.
Referenced by populate_recordset_worker().
|
static |
Definition at line 4001 of file jsonfuncs.c.
References PopulateRecordCache::argtype, PopulateRecordCache::c, ColumnIOData::composite, domain_check_safe(), CompositeIOData::domain_info, PopulateRecordCache::fn_mcxt, HeapTupleHeaderGetDatum(), HeapTupleHeaderGetDatumLength, InvalidOid, ColumnIOData::io, ItemPointerSetInvalid(), populate_record(), CompositeIOData::record_io, HeapTupleData::t_data, HeapTupleData::t_len, HeapTupleData::t_self, HeapTupleData::t_tableOid, CompositeIOData::tupdesc, tuplestore_puttuple(), ColumnIOData::typcat, TYPECAT_COMPOSITE_DOMAIN, and update_cached_tupdesc().
Referenced by populate_recordset_object_end(), and populate_recordset_worker().
|
static |
Definition at line 4289 of file jsonfuncs.c.
References ereport, errcode(), errmsg(), ERROR, PopulateRecordsetState::function_name, JSON_SUCCESS, PopulateRecordsetState::lex, JsonLexContext::lex_level, PopulateRecordsetState::saved_scalar, and token.
Referenced by populate_recordset_worker().
|
static |
Definition at line 4040 of file jsonfuncs.c.
References ReturnSetInfo::allowedModes, PopulateRecordCache::argtype, JsonSemAction::array_element_start, JsonSemAction::array_start, Assert, CompositeIOData::base_typid, CompositeIOData::base_typmod, PopulateRecordCache::c, ColumnIOData::composite, CreateTupleDescCopy(), ReturnSetInfo::econtext, ExprContext::ecxt_per_query_memory, ereport, errcode(), errmsg(), ERROR, FunctionCallInfoBaseData::flinfo, FmgrInfo::fn_extra, PopulateRecordCache::fn_mcxt, FmgrInfo::fn_mcxt, freeJsonLexContext(), funcname, get_record_type_from_argument(), get_record_type_from_query(), HeapTupleHeaderGetTypeId, HeapTupleHeaderGetTypMod, if(), ColumnIOData::io, JsObject::is_json, IsA, JB_ROOT_IS_ARRAY, JB_ROOT_IS_SCALAR, jbvBinary, JsObject::jsonb_cont, JsonbIteratorInit(), JsonbIteratorNext(), JsonContainerIsObject, makeJsonLexContext(), MemoryContextAllocZero(), MemoryContextSwitchTo(), JsonSemAction::object_end, JsonSemAction::object_field_end, JsonSemAction::object_field_start, JsonSemAction::object_start, palloc0(), PG_ARGISNULL, PG_GETARG_HEAPTUPLEHEADER, PG_GETARG_JSONB_P, PG_GETARG_TEXT_PP, pg_parse_json_or_ereport, PG_RETURN_NULL, populate_recordset_array_element_start(), populate_recordset_array_start(), populate_recordset_object_end(), populate_recordset_object_field_end(), populate_recordset_object_field_start(), populate_recordset_object_start(), populate_recordset_record(), populate_recordset_scalar(), FunctionCallInfoBaseData::resultinfo, ReturnSetInfo::returnMode, Jsonb::root, JsonSemAction::scalar, sem, JsonSemAction::semstate, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, SFRM_Materialize, SFRM_Materialize_Random, CompositeIOData::tupdesc, tuplestore_begin_heap(), JsonbValue::type, update_cached_tupdesc(), JsObject::val, JsonbValue::val, WJB_DONE, WJB_ELEM, and work_mem.
Referenced by json_populate_recordset(), json_to_recordset(), jsonb_populate_recordset(), and jsonb_to_recordset().
|
static |
Definition at line 3124 of file jsonfuncs.c.
References Assert, buf, DatumGetCString(), DirectFunctionCall1, elog, ERROR, escape_json(), escape_json_with_len(), initStringInfo(), InputFunctionCallSafe(), JsValue::is_json, jbvBinary, jbvBool, jbvNumeric, jbvString, JsValue::json, JSON_TOKEN_STRING, JsValue::jsonb, JsonbPGetDatum(), JsonbToCString(), JsonbValueToJsonb(), len, numeric_out(), palloc(), pfree(), pnstrdup(), PointerGetDatum(), pstrdup(), res, Jsonb::root, str, JsonbValue::type, ScalarIOData::typiofunc, ScalarIOData::typioparam, unconstify, JsValue::val, JsonbValue::val, and VARSIZE.
Referenced by populate_record_field().
|
static |
Definition at line 3250 of file jsonfuncs.c.
References ColumnIOData::array, DomainIOData::base_io, CompositeIOData::base_typid, DomainIOData::base_typid, CompositeIOData::base_typmod, DomainIOData::base_typmod, ColumnIOData::composite, ColumnIOData::domain, CompositeIOData::domain_info, DomainIOData::domain_info, ArrayIOData::element_info, ArrayIOData::element_type, ArrayIOData::element_typmod, elog, ERROR, fmgr_info_cxt(), get_typtype(), getBaseTypeAndTypmod(), GETSTRUCT, getTypeInputInfo(), HeapTupleIsValid, ColumnIOData::io, MemoryContextAllocZero(), ObjectIdGetDatum(), CompositeIOData::record_io, ReleaseSysCache(), ColumnIOData::scalar_io, SearchSysCache1(), CompositeIOData::tupdesc, ColumnIOData::typcat, type, TYPECAT_ARRAY, TYPECAT_COMPOSITE, TYPECAT_COMPOSITE_DOMAIN, TYPECAT_DOMAIN, TYPECAT_SCALAR, ColumnIOData::typid, ScalarIOData::typiofunc, ScalarIOData::typioparam, and ColumnIOData::typmod.
Referenced by get_record_type_from_argument(), and populate_record_field().
|
static |
Definition at line 1701 of file jsonfuncs.c.
References jbvNull, ps, pushJsonbValue(), JsonbValue::type, and WJB_ELEM.
Referenced by push_path(), and setPathArray().
|
static |
Definition at line 1720 of file jsonfuncs.c.
References i, jbvArray, jbvObject, jbvString, newval, palloc0(), push_null_elements(), pushJsonbValue(), strtoint(), TextDatumGetCString, JsonbValue::type, JsonbValue::val, WJB_BEGIN_ARRAY, WJB_BEGIN_OBJECT, WJB_ELEM, WJB_END_ARRAY, WJB_END_OBJECT, WJB_KEY, and WJB_VALUE.
Referenced by setPathArray(), and setPathObject().
|
static |
Definition at line 676 of file jsonfuncs.c.
References Assert, errcontext, JsonLexContext::input, JsonLexContext::input_length, IS_HIGHBIT_SET, JSON_TOKEN_END, JsonLexContext::line_number, JsonLexContext::line_start, palloc(), pg_mblen(), JsonLexContext::token_terminator, and JsonLexContext::token_type.
Referenced by json_errsave_error().
|
static |
Definition at line 5181 of file jsonfuncs.c.
References Assert, check_stack_depth(), elog, ereport, errcode(), errdetail(), errmsg(), ERROR, JB_PATH_FILL_GAPS, JsonbIteratorNext(), newval, pushJsonbValue(), res, setPathArray(), setPathObject(), JsonbValue::val, WJB_BEGIN_ARRAY, WJB_BEGIN_OBJECT, WJB_ELEM, WJB_END_ARRAY, WJB_END_OBJECT, and WJB_VALUE.
Referenced by jsonb_delete_path(), jsonb_insert(), jsonb_set(), jsonb_set_element(), setPathArray(), and setPathObject().
|
static |
Definition at line 5402 of file jsonfuncs.c.
References Assert, ereport, errcode(), errmsg(), ERROR, i, idx(), JB_PATH_CONSISTENT_POSITION, JB_PATH_CREATE, JB_PATH_CREATE_OR_INSERT, JB_PATH_FILL_GAPS, JB_PATH_INSERT_AFTER, JB_PATH_INSERT_BEFORE, JB_PATH_REPLACE, JsonbIteratorNext(), newval, pg_abs_s32(), PG_INT32_MIN, push_null_elements(), push_path(), pushJsonbValue(), setPath(), strtoint(), TextDatumGetCString, WJB_BEGIN_ARRAY, WJB_BEGIN_OBJECT, WJB_ELEM, WJB_END_ARRAY, and WJB_END_OBJECT.
Referenced by setPath().
|
static |
Definition at line 5263 of file jsonfuncs.c.
References Assert, DatumGetTextPP, ereport, errcode(), errhint(), errmsg(), ERROR, i, JB_PATH_CREATE_OR_INSERT, JB_PATH_DELETE, JB_PATH_FILL_GAPS, JB_PATH_INSERT_AFTER, JB_PATH_INSERT_BEFORE, jbvString, JsonbIteratorNext(), newval, push_path(), pushJsonbValue(), setPath(), JsonbValue::type, JsonbValue::val, VARDATA_ANY, VARSIZE_ANY_EXHDR, WJB_BEGIN_ARRAY, WJB_BEGIN_OBJECT, WJB_END_ARRAY, WJB_END_OBJECT, WJB_KEY, and WJB_VALUE.
Referenced by setPath().
|
static |
Definition at line 4459 of file jsonfuncs.c.
References appendStringInfoCharMacro, StringInfoData::data, JSON_SUCCESS, StringInfoData::len, and StripnullState::strval.
Referenced by json_strip_nulls().
|
static |
Definition at line 4419 of file jsonfuncs.c.
References appendStringInfoCharMacro, JSON_SUCCESS, and StripnullState::strval.
Referenced by json_strip_nulls().
|
static |
Definition at line 4409 of file jsonfuncs.c.
References appendStringInfoCharMacro, JSON_SUCCESS, and StripnullState::strval.
Referenced by json_strip_nulls().
|
static |
Definition at line 4399 of file jsonfuncs.c.
References appendStringInfoCharMacro, JSON_SUCCESS, and StripnullState::strval.
Referenced by json_strip_nulls().
|
static |
Definition at line 4429 of file jsonfuncs.c.
References appendStringInfoCharMacro, StringInfoData::data, escape_json(), JSON_SUCCESS, StringInfoData::len, StripnullState::skip_next_null, and StripnullState::strval.
Referenced by json_strip_nulls().
|
static |
Definition at line 4389 of file jsonfuncs.c.
References appendStringInfoCharMacro, JSON_SUCCESS, and StripnullState::strval.
Referenced by json_strip_nulls().
|
static |
Definition at line 4470 of file jsonfuncs.c.
References appendStringInfoString(), Assert, escape_json(), JSON_SUCCESS, JSON_TOKEN_NULL, JSON_TOKEN_STRING, StripnullState::skip_next_null, StripnullState::strval, and token.
Referenced by json_strip_nulls().
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().
|
static |
Definition at line 5921 of file jsonfuncs.c.
References appendStringInfoCharMacro, StringInfoData::data, JSON_SUCCESS, StringInfoData::len, and TransformJsonStringValuesState::strval.
Referenced by transform_json_string_values().
|
static |
Definition at line 5893 of file jsonfuncs.c.
References appendStringInfoCharMacro, JSON_SUCCESS, and TransformJsonStringValuesState::strval.
Referenced by transform_json_string_values().
|
static |
Definition at line 5883 of file jsonfuncs.c.
References appendStringInfoCharMacro, JSON_SUCCESS, and TransformJsonStringValuesState::strval.
Referenced by transform_json_string_values().
|
static |
Definition at line 5873 of file jsonfuncs.c.
References appendStringInfoCharMacro, JSON_SUCCESS, and TransformJsonStringValuesState::strval.
Referenced by transform_json_string_values().
|
static |
Definition at line 5903 of file jsonfuncs.c.
References appendStringInfoCharMacro, StringInfoData::data, escape_json(), JSON_SUCCESS, StringInfoData::len, and TransformJsonStringValuesState::strval.
Referenced by transform_json_string_values().
|
static |
Definition at line 5863 of file jsonfuncs.c.
References appendStringInfoCharMacro, JSON_SUCCESS, and TransformJsonStringValuesState::strval.
Referenced by transform_json_string_values().
|
static |
Definition at line 5932 of file jsonfuncs.c.
References TransformJsonStringValuesState::action, TransformJsonStringValuesState::action_state, appendStringInfoString(), escape_json_text(), JSON_SUCCESS, JSON_TOKEN_STRING, TransformJsonStringValuesState::strval, and token.
Referenced by transform_json_string_values().
|
static |
Definition at line 3028 of file jsonfuncs.c.
References CompositeIOData::base_typid, CompositeIOData::base_typmod, CreateTupleDescCopy(), FreeTupleDesc(), lookup_rowtype_tupdesc(), MemoryContextSwitchTo(), ReleaseTupleDesc, TupleDescData::tdtypeid, TupleDescData::tdtypmod, and CompositeIOData::tupdesc.
Referenced by populate_composite(), populate_recordset_record(), and populate_recordset_worker().