|
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"#include "utils/typcache.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 |
| #define DEFAULT_STATATT_AVG_WIDTH |
Definition at line 42 of file stat_utils.c.
| #define DEFAULT_STATATT_N_DISTINCT |
Definition at line 43 of file stat_utils.c.
| #define DEFAULT_STATATT_NULL_FRAC Float4GetDatum(0.0) /* stanullfrac */ |
Definition at line 41 of file stat_utils.c.
Definition at line 262 of file stat_utils.c.
References ereport, errmsg(), fb(), pg_strcasecmp(), and WARNING.
Referenced by stats_fill_fcinfo_from_arg_pairs().
Definition at line 142 of file stat_utils.c.
References ACL_MAINTAIN, aclcheck_error(), ACLCHECK_OK, arg, elog, ereport, errcode(), errdetail_relkind_not_supported(), errmsg(), ERROR, fb(), 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(), extended_statistics_update(), pg_clear_attribute_stats(), pg_clear_extended_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 567 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, fb(), FunctionCallInvoke, InitFunctionCallInfoData, Int32GetDatum(), InvalidOid, LOCAL_FCINFO, ObjectIdGetDatum(), pfree(), TextDatumGetCString, ThrowErrorData(), and WARNING.
Referenced by attribute_statistics_update().
Definition at line 523 of file stat_utils.c.
References fb(), get_base_element_type(), lookup_type_cache(), OidIsValid, and TYPECACHE_EQ_OPR.
Referenced by attribute_statistics_update().
Definition at line 303 of file stat_utils.c.
References attnum, elog, ERROR, fb(), 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 437 of file stat_utils.c.
References AccessShareLock, attnum, TypeCacheEntry::eq_opr, ereport, errcode(), errmsg(), ERROR, exprCollation(), exprType(), exprTypmod(), fb(), 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 713 of file stat_utils.c.
References attnum, BoolGetDatum(), DEFAULT_STATATT_AVG_WIDTH, DEFAULT_STATATT_N_DISTINCT, DEFAULT_STATATT_NULL_FRAC, fb(), 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 635 of file stat_utils.c.
References DatumGetInt16(), DatumGetObjectId(), ereport, errmsg(), ERROR, fb(), 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 70 of file stat_utils.c.
References ARR_NDIM, array_contains_nulls(), DatumGetArrayTypeP, ereport, errcode(), errmsg(), fb(), 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 111 of file stat_utils.c.
References ereport, errcode(), errmsg(), fb(), PG_ARGISNULL, and WARNING.
Referenced by attribute_statistics_update().
Definition at line 280 of file stat_utils.c.
References ereport, errmsg(), fb(), 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 51 of file stat_utils.c.
References ereport, errcode(), errmsg(), ERROR, fb(), and PG_ARGISNULL.
Referenced by attribute_statistics_update(), extended_statistics_update(), pg_clear_attribute_stats(), pg_clear_extended_stats(), and relation_statistics_update().
| bool stats_fill_fcinfo_from_arg_pairs | ( | FunctionCallInfo | pairs_fcinfo, |
| FunctionCallInfo | positional_fcinfo, | ||
| struct StatsArgInfo * | arginfo | ||
| ) |
Definition at line 348 of file stat_utils.c.
References ereport, errhint(), errmsg(), ERROR, extract_variadic_args(), fb(), format_type_be(), get_arg_by_name(), i, pg_strcasecmp(), stats_check_arg_type(), TextDatumGetCString, and types.
Referenced by pg_restore_attribute_stats(), pg_restore_extended_stats(), and pg_restore_relation_stats().