|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/htup_details.h"#include "access/relation.h"#include "catalog/index.h"#include "catalog/namespace.h"#include "catalog/pg_class.h"#include "catalog/pg_collation.h"#include "catalog/pg_database.h"#include "catalog/pg_statistic.h"#include "funcapi.h"#include "miscadmin.h"#include "nodes/nodeFuncs.h"#include "statistics/stat_utils.h"#include "storage/lmgr.h"#include "utils/acl.h"#include "utils/array.h"#include "utils/builtins.h"#include "utils/lsyscache.h"#include "utils/rel.h"#include "utils/syscache.h"
Go to the source code of this file.
Macros | |
| #define | DEFAULT_STATATT_NULL_FRAC Float4GetDatum(0.0) /* stanullfrac */ |
| #define | DEFAULT_STATATT_AVG_WIDTH |
| #define | DEFAULT_STATATT_N_DISTINCT |
Functions | |
| static Node * | statatt_get_index_expr (Relation rel, int attnum) |
| void | stats_check_required_arg (FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum) |
| bool | stats_check_arg_array (FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum) |
| bool | stats_check_arg_pair (FunctionCallInfo fcinfo, struct StatsArgInfo *arginfo, int argnum1, int argnum2) |
| void | RangeVarCallbackForStats (const RangeVar *relation, Oid relId, Oid oldRelId, void *arg) |
| static int | get_arg_by_name (const char *argname, struct StatsArgInfo *arginfo) |
| static bool | stats_check_arg_type (const char *argname, Oid argtype, Oid expectedtype) |
| bool | stats_fill_fcinfo_from_arg_pairs (FunctionCallInfo pairs_fcinfo, FunctionCallInfo positional_fcinfo, struct StatsArgInfo *arginfo) |
| void | statatt_get_type (Oid reloid, AttrNumber attnum, Oid *atttypid, int32 *atttypmod, char *atttyptype, Oid *atttypcoll, Oid *eq_opr, Oid *lt_opr) |
| bool | statatt_get_elem_type (Oid atttypid, char atttyptype, Oid *elemtypid, Oid *elem_eq_opr) |
| Datum | statatt_build_stavalues (const char *staname, FmgrInfo *array_in, Datum d, Oid typid, int32 typmod, bool *ok) |
| void | statatt_set_slot (Datum *values, bool *nulls, bool *replaces, int16 stakind, Oid staop, Oid stacoll, Datum stanumbers, bool stanumbers_isnull, Datum stavalues, bool stavalues_isnull) |
| void | statatt_init_empty_tuple (Oid reloid, int16 attnum, bool inherited, Datum *values, bool *nulls, bool *replaces) |
| #define DEFAULT_STATATT_AVG_WIDTH |
Definition at line 41 of file stat_utils.c.
| #define DEFAULT_STATATT_N_DISTINCT |
Definition at line 42 of file stat_utils.c.
| #define DEFAULT_STATATT_NULL_FRAC Float4GetDatum(0.0) /* stanullfrac */ |
Definition at line 40 of file stat_utils.c.
|
static |
Definition at line 261 of file stat_utils.c.
References StatsArgInfo::argname, ereport, errmsg(), pg_strcasecmp(), and WARNING.
Referenced by stats_fill_fcinfo_from_arg_pairs().
Definition at line 141 of file stat_utils.c.
References ACL_MAINTAIN, aclcheck_error(), ACLCHECK_OK, arg, elog, ereport, errcode(), errdetail_relkind_not_supported(), errmsg(), ERROR, get_rel_relkind(), get_relkind_objtype(), GETSTRUCT(), GetUserId(), HeapTupleIsValid, IndexGetRelation(), InvalidOid, LockRelationOid(), MyDatabaseId, NameStr, object_ownercheck(), ObjectIdGetDatum(), OidIsValid, pg_class_aclcheck(), ReleaseSysCache(), RangeVar::relname, SearchSysCache1(), ShareUpdateExclusiveLock, and UnlockRelationOid().
Referenced by attribute_statistics_update(), pg_clear_attribute_stats(), and relation_statistics_update().
| Datum statatt_build_stavalues | ( | const char * | staname, |
| FmgrInfo * | array_in, | ||
| Datum | d, | ||
| Oid | typid, | ||
| int32 | typmod, | ||
| bool * | ok | ||
| ) |
Definition at line 566 of file stat_utils.c.
References array_contains_nulls(), array_in(), CStringGetDatum(), DatumGetArrayTypeP, ErrorSaveContext::details_wanted, ErrorData::elevel, ereport, errcode(), errmsg(), ErrorSaveContext::error_data, ErrorSaveContext::error_occurred, FunctionCallInvoke, InitFunctionCallInfoData, Int32GetDatum(), InvalidOid, LOCAL_FCINFO, ObjectIdGetDatum(), pfree(), TextDatumGetCString, ThrowErrorData(), and WARNING.
Referenced by attribute_statistics_update().
Definition at line 522 of file stat_utils.c.
References TypeCacheEntry::eq_opr, get_base_element_type(), lookup_type_cache(), OidIsValid, and TYPECACHE_EQ_OPR.
Referenced by attribute_statistics_update().
Definition at line 302 of file stat_utils.c.
References attnum, elog, ERROR, i, lfirst, list_head(), lnext(), NIL, RelationData::rd_index, RelationData::rd_indexprs, RelationData::rd_rel, and RelationGetIndexExpressions().
Referenced by statatt_get_type().
| void statatt_get_type | ( | Oid | reloid, |
| AttrNumber | attnum, | ||
| Oid * | atttypid, | ||
| int32 * | atttypmod, | ||
| char * | atttyptype, | ||
| Oid * | atttypcoll, | ||
| Oid * | eq_opr, | ||
| Oid * | lt_opr | ||
| ) |
Definition at line 436 of file stat_utils.c.
References AccessShareLock, attnum, TypeCacheEntry::eq_opr, ereport, errcode(), errmsg(), ERROR, exprCollation(), exprType(), exprTypmod(), get_multirange_range(), GETSTRUCT(), HeapTupleIsValid, Int16GetDatum(), lookup_type_cache(), TypeCacheEntry::lt_opr, NoLock, ObjectIdGetDatum(), OidIsValid, relation_close(), relation_open(), RelationGetRelationName, ReleaseSysCache(), SearchSysCache2(), statatt_get_index_expr(), type_is_multirange(), TYPECACHE_EQ_OPR, TYPECACHE_LT_OPR, and TypeCacheEntry::typtype.
Referenced by attribute_statistics_update().
| void statatt_init_empty_tuple | ( | Oid | reloid, |
| int16 | attnum, | ||
| bool | inherited, | ||
| Datum * | values, | ||
| bool * | nulls, | ||
| bool * | replaces | ||
| ) |
Definition at line 712 of file stat_utils.c.
References attnum, BoolGetDatum(), DEFAULT_STATATT_AVG_WIDTH, DEFAULT_STATATT_N_DISTINCT, DEFAULT_STATATT_NULL_FRAC, Int16GetDatum(), InvalidOid, ObjectIdGetDatum(), STATISTIC_NUM_SLOTS, and values.
Referenced by attribute_statistics_update().
| void statatt_set_slot | ( | Datum * | values, |
| bool * | nulls, | ||
| bool * | replaces, | ||
| int16 | stakind, | ||
| Oid | staop, | ||
| Oid | stacoll, | ||
| Datum | stanumbers, | ||
| bool | stanumbers_isnull, | ||
| Datum | stavalues, | ||
| bool | stavalues_isnull | ||
| ) |
Definition at line 634 of file stat_utils.c.
References DatumGetInt16(), DatumGetObjectId(), ereport, errmsg(), ERROR, Int16GetDatum(), ObjectIdGetDatum(), STATISTIC_NUM_SLOTS, and values.
Referenced by attribute_statistics_update().
| bool stats_check_arg_array | ( | FunctionCallInfo | fcinfo, |
| struct StatsArgInfo * | arginfo, | ||
| int | argnum | ||
| ) |
Definition at line 69 of file stat_utils.c.
References ARR_NDIM, array_contains_nulls(), DatumGetArrayTypeP, ereport, errcode(), errmsg(), PG_ARGISNULL, PG_GETARG_DATUM, and WARNING.
Referenced by attribute_statistics_update().
| bool stats_check_arg_pair | ( | FunctionCallInfo | fcinfo, |
| struct StatsArgInfo * | arginfo, | ||
| int | argnum1, | ||
| int | argnum2 | ||
| ) |
Definition at line 110 of file stat_utils.c.
References ereport, errcode(), errmsg(), PG_ARGISNULL, and WARNING.
Referenced by attribute_statistics_update().
Definition at line 279 of file stat_utils.c.
References ereport, errmsg(), format_type_be(), and WARNING.
Referenced by stats_fill_fcinfo_from_arg_pairs().
| void stats_check_required_arg | ( | FunctionCallInfo | fcinfo, |
| struct StatsArgInfo * | arginfo, | ||
| int | argnum | ||
| ) |
Definition at line 50 of file stat_utils.c.
References ereport, errcode(), errmsg(), ERROR, and PG_ARGISNULL.
Referenced by attribute_statistics_update(), pg_clear_attribute_stats(), and relation_statistics_update().
| bool stats_fill_fcinfo_from_arg_pairs | ( | FunctionCallInfo | pairs_fcinfo, |
| FunctionCallInfo | positional_fcinfo, | ||
| struct StatsArgInfo * | arginfo | ||
| ) |
Definition at line 347 of file stat_utils.c.
References StatsArgInfo::argname, generate_unaccent_rules::args, FunctionCallInfoBaseData::args, ereport, errhint(), errmsg(), ERROR, extract_variadic_args(), format_type_be(), get_arg_by_name(), i, NullableDatum::isnull, pg_strcasecmp(), stats_check_arg_type(), TextDatumGetCString, types, and NullableDatum::value.
Referenced by pg_restore_attribute_stats(), and pg_restore_relation_stats().