PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/heapam.h"
#include "access/relation.h"
#include "access/relscan.h"
#include "access/table.h"
#include "catalog/catalog.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/namespace.h"
#include "catalog/objectaccess.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_statistic_ext.h"
#include "catalog/pg_statistic_ext_data.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "miscadmin.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/optimizer.h"
#include "statistics/statistics.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/inval.h"
#include "utils/memutils.h"
#include "utils/rel.h"
#include "utils/syscache.h"
#include "utils/typcache.h"
Go to the source code of this file.
Functions | |
static char * | ChooseExtendedStatisticName (const char *name1, const char *name2, const char *label, Oid namespaceid) |
static char * | ChooseExtendedStatisticNameAddition (List *exprs) |
static int | compare_int16 (const void *a, const void *b) |
ObjectAddress | CreateStatistics (CreateStatsStmt *stmt) |
ObjectAddress | AlterStatistics (AlterStatsStmt *stmt) |
void | RemoveStatisticsById (Oid statsOid) |
Oid | StatisticsGetRelation (Oid statId, bool missing_ok) |
ObjectAddress AlterStatistics | ( | AlterStatsStmt * | stmt | ) |
Definition at line 589 of file statscmds.c.
References aclcheck_error(), ACLCHECK_NOT_OWNER, Assert, CatalogTupleUpdate(), DeconstructQualifiedName(), AlterStatsStmt::defnames, ereport, errcode(), errmsg(), ERROR, get_statistics_object_oid(), GetUserId(), heap_freetuple(), heap_modify_tuple(), Int32GetDatum, InvalidObjectAddress, InvokeObjectPostAlterHook, AlterStatsStmt::missing_ok, NameListToString(), NOTICE, OBJECT_STATISTIC_EXT, ObjectAddressSet, ObjectIdGetDatum, OidIsValid, pg_statistics_object_ownercheck(), RelationGetDescr, ReleaseSysCache(), RowExclusiveLock, SearchSysCache1(), STATEXTOID, AlterStatsStmt::stxstattarget, HeapTupleData::t_self, table_close(), table_open(), and WARNING.
Referenced by ProcessUtilitySlow().
|
static |
Definition at line 757 of file statscmds.c.
References GetSysCacheOid2, makeObjectName(), NAMEDATALEN, ObjectIdGetDatum, OidIsValid, pfree(), PointerGetDatum, snprintf, STATEXTNAMENSP, and strlcpy().
Referenced by CreateStatistics().
|
static |
Definition at line 799 of file statscmds.c.
References buf, IsA, lfirst, name, StatsElem::name, NAMEDATALEN, pstrdup(), and strlcpy().
Referenced by CreateStatistics().
|
static |
ObjectAddress CreateStatistics | ( | CreateStatsStmt * | stmt | ) |
Definition at line 64 of file statscmds.c.
References aclcheck_error(), ACLCHECK_NOT_OWNER, allowSystemTableMods, Assert, attname, buildint2vector(), CacheInvalidateRelcache(), CatalogTupleInsert(), CharGetDatum, ChooseExtendedStatisticName(), ChooseExtendedStatisticNameAddition(), compare_int16(), construct_array(), CreateComments(), CStringGetDatum, CStringGetTextDatum, CreateStatsStmt::defnames, DEPENDENCY_AUTO, DEPENDENCY_NORMAL, equal(), ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errmsg(), ERROR, StatsElem::expr, CreateStatsStmt::exprs, exprType(), format_type_be(), get_relkind_objtype(), GetNewOidWithIndex(), GETSTRUCT, GetUserId(), heap_form_tuple(), heap_freetuple(), HeapTupleIsValid, i, CreateStatsStmt::if_not_exists, Int32GetDatum, InvalidObjectAddress, InvalidOid, InvokeObjectPostCreateHook, IsA, IsSystemRelation(), lappend(), lengthof, lfirst, list_length(), lookup_type_cache(), TypeCacheEntry::lt_opr, StatsElem::name, NameGetDatum, namestrcpy(), NIL, nodeToString(), NoLock, NOTICE, ObjectAddressSet, ObjectAddressSubSet, ObjectIdGetDatum, pfree(), pg_class_ownercheck(), PointerGetDatum, qsort, QualifiedNameGetCreationNamespace(), RelationData::rd_att, RelationData::rd_rel, recordDependencyOn(), recordDependencyOnOwner(), recordDependencyOnSingleRelExpr(), relation_close(), relation_openrv(), RelationGetNamespace, RelationGetRelationName, RelationGetRelid, CreateStatsStmt::relations, ReleaseSysCache(), RowExclusiveLock, SearchSysCacheAttName(), SearchSysCacheExists2, ShareUpdateExclusiveLock, CreateStatsStmt::stat_types, STATEXTNAMENSP, StatisticExtOidIndexId, STATS_MAX_DIMENSIONS, strVal, CreateStatsStmt::stxcomment, table_open(), generate_unaccent_rules::type, TYPECACHE_LT_OPR, types, and values.
Referenced by ATExecAddStatistics(), and ProcessUtilitySlow().
void RemoveStatisticsById | ( | Oid | statsOid | ) |
Definition at line 693 of file statscmds.c.
References CacheInvalidateRelcacheByRelid(), CatalogTupleDelete(), elog, ERROR, GETSTRUCT, HeapTupleIsValid, ObjectIdGetDatum, ReleaseSysCache(), RowExclusiveLock, SearchSysCache1(), STATEXTDATASTXOID, STATEXTOID, HeapTupleData::t_self, table_close(), and table_open().
Referenced by doDeletion().
Definition at line 846 of file statscmds.c.
References Assert, elog, ERROR, GETSTRUCT, HeapTupleIsValid, InvalidOid, ObjectIdGetDatum, ReleaseSysCache(), SearchSysCache1(), and STATEXTOID.
Referenced by ATPostAlterTypeCleanup().