|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/heapam.h"#include "catalog/indexing.h"#include "catalog/namespace.h"#include "catalog/pg_database.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/lsyscache.h"#include "utils/syscache.h"
Go to the source code of this file.
Data Structures | |
| struct | StakindFlags |
Enumerations | |
| enum | extended_stats_argnum { RELSCHEMA_ARG = 0 , RELNAME_ARG , STATSCHEMA_ARG , STATNAME_ARG , INHERITED_ARG , NDISTINCT_ARG , DEPENDENCIES_ARG , MOST_COMMON_VALS_ARG , MOST_COMMON_FREQS_ARG , MOST_COMMON_BASE_FREQS_ARG , NUM_EXTENDED_STATS_ARGS } |
Functions | |
| static bool | extended_statistics_update (FunctionCallInfo fcinfo) |
| static HeapTuple | get_pg_statistic_ext (Relation pg_stext, Oid nspoid, const char *stxname) |
| static bool | delete_pg_statistic_ext_data (Oid stxoid, bool inherited) |
| static void | expand_stxkind (HeapTuple tup, StakindFlags *enabled) |
| static void | upsert_pg_statistic_ext_data (const Datum *values, const bool *nulls, const bool *replaces) |
| static bool | check_mcvlist_array (const ArrayType *arr, int argindex, int required_ndims, int mcv_length) |
| static Datum | import_mcv (const ArrayType *mcv_arr, const ArrayType *freqs_arr, const ArrayType *base_freqs_arr, Oid *atttypids, int32 *atttypmods, Oid *atttypcolls, int numattrs, bool *ok) |
| Datum | pg_restore_extended_stats (PG_FUNCTION_ARGS) |
| Datum | pg_clear_extended_stats (PG_FUNCTION_ARGS) |
Variables | |
| static struct StatsArgInfo | extarginfo [] |
Definition at line 42 of file extended_stats_funcs.c.
|
static |
Definition at line 660 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 772 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 161 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 249 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(), exprType(), exprTypmod(), extarginfo, fb(), fix_opfuncids(), get_namespace_oid(), get_pg_statistic_ext(), GETSTRUCT(), heap_freetuple(), HeapTupleIsValid, i, 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, quote_identifier(), 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 113 of file extended_stats_funcs.c.
References BTEqualStrategyNumber, CStringGetDatum(), fb(), 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 700 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().
| Datum pg_clear_extended_stats | ( | PG_FUNCTION_ARGS | ) |
Definition at line 826 of file extended_stats_funcs.c.
References delete_pg_statistic_ext_data(), ereport, errcode(), errhint(), errmsg(), extarginfo, fb(), 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 805 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 203 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 61 of file extended_stats_funcs.c.
Referenced by check_mcvlist_array(), extended_statistics_update(), import_mcv(), pg_clear_extended_stats(), and pg_restore_extended_stats().