|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/heapam.h"#include "catalog/indexing.h"#include "catalog/namespace.h"#include "catalog/pg_collation_d.h"#include "catalog/pg_database.h"#include "catalog/pg_operator.h"#include "catalog/pg_statistic_ext.h"#include "catalog/pg_statistic_ext_data.h"#include "miscadmin.h"#include "nodes/makefuncs.h"#include "nodes/nodeFuncs.h"#include "optimizer/optimizer.h"#include "statistics/extended_stats_internal.h"#include "statistics/stat_utils.h"#include "utils/acl.h"#include "utils/array.h"#include "utils/builtins.h"#include "utils/fmgroids.h"#include "utils/jsonb.h"#include "utils/lsyscache.h"#include "utils/syscache.h"#include "utils/typcache.h"
Go to the source code of this file.
Data Structures | |
| struct | StakindFlags |
Variables | |
| static struct StatsArgInfo | extarginfo [] |
| static const char * | extexprargname [NUM_ATTRIBUTE_STATS_ELEMS] |
Definition at line 46 of file extended_stats_funcs.c.
Definition at line 86 of file extended_stats_funcs.c.
|
static |
Definition at line 1028 of file extended_stats_funcs.c.
References appendStringInfo(), array_contains_nulls(), array_in(), CStringGetDatum(), DatumGetArrayTypeP, ErrorData::elevel, ereport, errcode(), errmsg, ErrorSaveContext::error_data, ErrorSaveContext::error_occurred, fb(), FunctionCallInvoke, ErrorData::hint, InitFunctionCallInfoData, initStringInfo(), Int32GetDatum(), InvalidOid, LOCAL_FCINFO, ObjectIdGetDatum(), pfree(), ThrowErrorData(), ErrorSaveContext::type, and WARNING.
Referenced by import_pg_statistic().
|
static |
Definition at line 899 of file extended_stats_funcs.c.
References Assert, ereport, errcode(), errmsg, fb(), jbv_string_get_cstr(), jbvString, JsonbIteratorInit(), JsonbIteratorNext(), JsonContainerIsObject, key_in_expr_argnames(), pfree(), WARNING, WJB_BEGIN_OBJECT, WJB_END_OBJECT, WJB_KEY, and WJB_VALUE.
Referenced by import_pg_statistic().
|
static |
Definition at line 773 of file extended_stats_funcs.c.
References StatsArgInfo::argname, ARR_DIMS, ARR_NDIM, array_contains_nulls(), ereport, errcode(), errmsg, extarginfo, fb(), MOST_COMMON_VALS_ARG, and WARNING.
Referenced by import_mcv().
Definition at line 1665 of file extended_stats_funcs.c.
References BoolGetDatum(), CatalogTupleDelete(), CommandCounterIncrement(), fb(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), RowExclusiveLock, SearchSysCache2(), table_close(), and table_open().
Referenced by pg_clear_extended_stats().
|
static |
Definition at line 226 of file extended_stats_funcs.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_HASNULL, ARR_NDIM, DatumGetArrayTypeP, StakindFlags::dependencies, elog, ERROR, StakindFlags::expressions, fb(), i, StakindFlags::mcv, StakindFlags::ndistinct, and SysCacheGetAttrNotNull().
Referenced by extended_statistics_update().
|
static |
Definition at line 314 of file extended_stats_funcs.c.
References StatsArgInfo::argname, Assert, attnum, BoolGetDatum(), cleanup(), data, DatumGetByteaPP, StakindFlags::dependencies, DEPENDENCIES_ARG, elog, ereport, errcode(), errhint(), errmsg, ERROR, eval_const_expressions(), expand_stxkind(), exprCollation(), StakindFlags::expressions, EXPRESSIONS_ARG, exprType(), exprTypmod(), extarginfo, fb(), fix_opfuncids(), Form_pg_statistic_ext, get_namespace_oid(), get_pg_statistic_ext(), GETSTRUCT(), heap_freetuple(), HeapTupleIsValid, i, import_expressions(), import_mcv(), INHERITED_ARG, Int16GetDatum(), InvalidOid, list_length(), list_nth(), makeRangeVar(), StakindFlags::mcv, MOST_COMMON_BASE_FREQS_ARG, MOST_COMMON_FREQS_ARG, MOST_COMMON_VALS_ARG, StakindFlags::ndistinct, NDISTINCT_ARG, NIL, ObjectIdGetDatum(), palloc0_array, pfree(), PG_ARGISNULL, PG_GETARG_ARRAYTYPE_P, PG_GETARG_BOOL, PG_GETARG_DATUM, PG_GETARG_JSONB_P, RangeVarCallbackForStats(), RangeVarGetRelidExtended(), RecoveryInProgress(), ReleaseSysCache(), relname, RELNAME_ARG, RELSCHEMA_ARG, RowExclusiveLock, SearchSysCache2(), ShareUpdateExclusiveLock, statext_dependencies_deserialize(), statext_dependencies_free(), statext_dependencies_validate(), statext_ndistinct_deserialize(), statext_ndistinct_free(), statext_ndistinct_validate(), STATNAME_ARG, stats_check_required_arg(), STATSCHEMA_ARG, stringToNode(), success, SysCacheGetAttr(), table_close(), table_open(), TextDatumGetCString, upsert_pg_statistic_ext_data(), values, and WARNING.
Referenced by pg_restore_extended_stats().
|
static |
Definition at line 178 of file extended_stats_funcs.c.
References BTEqualStrategyNumber, CStringGetDatum(), fb(), Form_pg_statistic_ext, GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), OidIsValid, ScanKeyInit(), SearchSysCacheCopy1, systable_beginscan(), systable_endscan(), and systable_getnext().
Referenced by extended_statistics_update(), and pg_clear_extended_stats().
|
static |
Definition at line 1535 of file extended_stats_funcs.c.
References accumArrayResult(), StatsArgInfo::argname, CurrentMemoryContext, ereport, errcode(), errmsg, EXPRESSIONS_ARG, extarginfo, fb(), fmgr_info(), get_rel_type_id(), getIthJsonbValueFromContainer(), i, import_pg_statistic(), JB_ROOT_IS_ARRAY, jbvBinary, jbvNull, JsonContainerSize, makeArrayResult(), pfree(), root, JsonbValue::type, JsonbValue::val, and WARNING.
Referenced by extended_statistics_update().
|
static |
Definition at line 813 of file extended_stats_funcs.c.
References StatsArgInfo::argname, ARR_DATA_PTR, ARR_DIMS, ARR_NDIM, check_mcvlist_array(), deconstruct_array_builtin(), ereport, errcode(), errmsg, extarginfo, fb(), MOST_COMMON_BASE_FREQS_ARG, MOST_COMMON_FREQS_ARG, MOST_COMMON_VALS_ARG, nitems, statext_mcv_import(), and WARNING.
Referenced by extended_statistics_update().
|
static |
Definition at line 1098 of file extended_stats_funcs.c.
References StatsArgInfo::argname, array_in_safe(), AVG_WIDTH_ELEM, check_all_expr_argnames_valid(), construct_array_builtin(), corr, CORRELATION_ELEM, ELEM_COUNT_HISTOGRAM_ELEM, TypeCacheEntry::eq_opr, ereport, errcode(), errhint(), errmsg, EXPRESSIONS_ARG, extarginfo, extexprargname, fb(), float4in(), get_multirange_range(), getKeyJsonValueFromContainer(), heap_copy_tuple_as_datum(), heap_form_tuple(), heap_freetuple(), HISTOGRAM_BOUNDS_ELEM, i, int4in(), InvalidAttrNumber, InvalidOid, jbv_string_get_cstr(), jbv_to_infunc_datum(), jbvNull, jbvString, JsonContainerIsObject, len, lookup_type_cache(), TypeCacheEntry::lt_opr, MOST_COMMON_ELEM_FREQS_ELEM, MOST_COMMON_ELEMS_ELEM, MOST_COMMON_FREQS_ELEM, MOST_COMMON_VALS_ELEM, N_DISTINCT_ELEM, NULL_FRAC_ELEM, NUM_ATTRIBUTE_STATS_ELEMS, pfree(), PointerGetDatum(), RANGE_BOUNDS_HISTOGRAM_ELEM, RANGE_EMPTY_FRAC_ELEM, RANGE_LENGTH_HISTOGRAM_ELEM, RelationGetDescr, statatt_get_elem_type(), statatt_init_empty_tuple(), statatt_set_slot(), type, type_is_multirange(), TYPECACHE_EQ_OPR, TYPECACHE_LT_OPR, TypeCacheEntry::typtype, val, values, and WARNING.
Referenced by import_expressions().
|
static |
Definition at line 965 of file extended_stats_funcs.c.
References Assert, fb(), jbvString, and palloc0().
Referenced by check_all_expr_argnames_valid(), import_pg_statistic(), and jbv_to_infunc_datum().
|
static |
Definition at line 981 of file extended_stats_funcs.c.
References appendStringInfo(), StatsArgInfo::argname, DirectInputFunctionCallSafe(), ErrorData::elevel, ErrorSaveContext::error_data, fb(), ErrorData::hint, initStringInfo(), InvalidOid, jbv_string_get_cstr(), pfree(), ThrowErrorData(), ErrorSaveContext::type, and WARNING.
Referenced by import_pg_statistic().
|
static |
Definition at line 884 of file extended_stats_funcs.c.
References Assert, extexprargname, fb(), i, jbvString, and NUM_ATTRIBUTE_STATS_ELEMS.
Referenced by check_all_expr_argnames_valid().
| Datum pg_clear_extended_stats | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1719 of file extended_stats_funcs.c.
References delete_pg_statistic_ext_data(), ereport, errcode(), errhint(), errmsg, extarginfo, fb(), Form_pg_statistic_ext, get_namespace_name(), get_namespace_oid(), get_pg_statistic_ext(), GETSTRUCT(), heap_freetuple(), HeapTupleIsValid, INHERITED_ARG, InvalidOid, makeRangeVar(), PG_GETARG_BOOL, PG_GETARG_DATUM, PG_RETURN_VOID, RangeVarCallbackForStats(), RangeVarGetRelidExtended(), RecoveryInProgress(), relname, RELNAME_ARG, RELSCHEMA_ARG, RowExclusiveLock, ShareUpdateExclusiveLock, STATNAME_ARG, stats_check_required_arg(), STATSCHEMA_ARG, table_close(), table_open(), TextDatumGetCString, and WARNING.
| Datum pg_restore_extended_stats | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1698 of file extended_stats_funcs.c.
References extarginfo, extended_statistics_update(), fb(), InitFunctionCallInfoData, InvalidOid, LOCAL_FCINFO, NUM_EXTENDED_STATS_ARGS, PG_RETURN_BOOL, and stats_fill_fcinfo_from_arg_pairs().
|
static |
Definition at line 268 of file extended_stats_funcs.c.
References CatalogTupleInsert(), CatalogTupleUpdate(), CommandCounterIncrement(), fb(), heap_form_tuple(), heap_freetuple(), heap_modify_tuple(), HeapTupleIsValid, RelationGetDescr, ReleaseSysCache(), RowExclusiveLock, SearchSysCache2(), table_close(), table_open(), and values.
Referenced by extended_statistics_update().
|
static |
Definition at line 66 of file extended_stats_funcs.c.
Referenced by check_mcvlist_array(), extended_statistics_update(), import_expressions(), import_mcv(), import_pg_statistic(), pg_clear_extended_stats(), and pg_restore_extended_stats().
|
static |
Definition at line 107 of file extended_stats_funcs.c.
Referenced by import_pg_statistic(), and key_in_expr_argnames().