PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/attmap.h"
#include "access/genam.h"
#include "access/gist.h"
#include "access/heapam.h"
#include "access/heapam_xlog.h"
#include "access/multixact.h"
#include "access/reloptions.h"
#include "access/relscan.h"
#include "access/sysattr.h"
#include "access/tableam.h"
#include "access/toast_compression.h"
#include "access/xact.h"
#include "access/xlog.h"
#include "access/xloginsert.h"
#include "catalog/catalog.h"
#include "catalog/heap.h"
#include "catalog/index.h"
#include "catalog/namespace.h"
#include "catalog/objectaccess.h"
#include "catalog/partition.h"
#include "catalog/pg_am.h"
#include "catalog/pg_attrdef.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_constraint.h"
#include "catalog/pg_depend.h"
#include "catalog/pg_foreign_table.h"
#include "catalog/pg_inherits.h"
#include "catalog/pg_largeobject.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_opclass.h"
#include "catalog/pg_policy.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_rewrite.h"
#include "catalog/pg_statistic_ext.h"
#include "catalog/pg_tablespace.h"
#include "catalog/pg_trigger.h"
#include "catalog/pg_type.h"
#include "catalog/storage.h"
#include "catalog/storage_xlog.h"
#include "catalog/toasting.h"
#include "commands/cluster.h"
#include "commands/comment.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
#include "commands/sequence.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "commands/trigger.h"
#include "commands/typecmds.h"
#include "commands/user.h"
#include "commands/vacuum.h"
#include "executor/executor.h"
#include "foreign/fdwapi.h"
#include "foreign/foreign.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "nodes/parsenodes.h"
#include "optimizer/optimizer.h"
#include "parser/parse_coerce.h"
#include "parser/parse_collate.h"
#include "parser/parse_expr.h"
#include "parser/parse_relation.h"
#include "parser/parse_type.h"
#include "parser/parse_utilcmd.h"
#include "parser/parser.h"
#include "partitioning/partbounds.h"
#include "partitioning/partdesc.h"
#include "pgstat.h"
#include "rewrite/rewriteDefine.h"
#include "rewrite/rewriteHandler.h"
#include "rewrite/rewriteManip.h"
#include "storage/bufmgr.h"
#include "storage/lmgr.h"
#include "storage/lock.h"
#include "storage/predicate.h"
#include "storage/smgr.h"
#include "tcop/utility.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/inval.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/partcache.h"
#include "utils/relcache.h"
#include "utils/ruleutils.h"
#include "utils/snapmgr.h"
#include "utils/syscache.h"
#include "utils/timestamp.h"
#include "utils/typcache.h"
#include "utils/usercontext.h"
Go to the source code of this file.
Data Structures | |
struct | OnCommitItem |
struct | AlteredTableInfo |
struct | NewConstraint |
struct | NewColumnValue |
struct | dropmsgstrings |
struct | DropRelationCallbackState |
struct | ForeignTruncateInfo |
struct | AttachIndexCallbackState |
struct | SplitPartitionContext |
Macros | |
#define | AT_NUM_PASSES (AT_PASS_MISC + 1) |
#define | ATT_TABLE 0x0001 |
#define | ATT_VIEW 0x0002 |
#define | ATT_MATVIEW 0x0004 |
#define | ATT_INDEX 0x0008 |
#define | ATT_COMPOSITE_TYPE 0x0010 |
#define | ATT_FOREIGN_TABLE 0x0020 |
#define | ATT_PARTITIONED_INDEX 0x0040 |
#define | ATT_SEQUENCE 0x0080 |
#define | child_dependency_type(child_is_partition) ((child_is_partition) ? DEPENDENCY_AUTO : DEPENDENCY_NORMAL) |
Typedefs | |
typedef struct OnCommitItem | OnCommitItem |
typedef enum AlterTablePass | AlterTablePass |
typedef struct AlteredTableInfo | AlteredTableInfo |
typedef struct NewConstraint | NewConstraint |
typedef struct NewColumnValue | NewColumnValue |
typedef struct ForeignTruncateInfo | ForeignTruncateInfo |
typedef struct SplitPartitionContext | SplitPartitionContext |
Enumerations | |
enum | AlterTablePass { AT_PASS_UNSET = -1 , AT_PASS_DROP , AT_PASS_ALTER_TYPE , AT_PASS_ADD_COL , AT_PASS_SET_EXPRESSION , AT_PASS_OLD_COL_ATTRS , AT_PASS_OLD_INDEX , AT_PASS_OLD_CONSTR , AT_PASS_ADD_CONSTR , AT_PASS_COL_ATTRS , AT_PASS_ADD_INDEXCONSTR , AT_PASS_ADD_INDEX , AT_PASS_ADD_OTHERCONSTR , AT_PASS_MISC } |
Functions | |
static void | truncate_check_rel (Oid relid, Form_pg_class reltuple) |
static void | truncate_check_perms (Oid relid, Form_pg_class reltuple) |
static void | truncate_check_activity (Relation rel) |
static void | RangeVarCallbackForTruncate (const RangeVar *relation, Oid relId, Oid oldRelId, void *arg) |
static List * | MergeAttributes (List *columns, const List *supers, char relpersistence, bool is_partition, List **supconstr, List **supnotnulls) |
static List * | MergeCheckConstraint (List *constraints, const char *name, Node *expr) |
static void | MergeChildAttribute (List *inh_columns, int exist_attno, int newcol_attno, const ColumnDef *newdef) |
static ColumnDef * | MergeInheritedAttribute (List *inh_columns, int exist_attno, const ColumnDef *newdef) |
static void | MergeAttributesIntoExisting (Relation child_rel, Relation parent_rel, bool ispartition) |
static void | MergeConstraintsIntoExisting (Relation child_rel, Relation parent_rel) |
static void | StoreCatalogInheritance (Oid relationId, List *supers, bool child_is_partition) |
static void | StoreCatalogInheritance1 (Oid relationId, Oid parentOid, int32 seqNumber, Relation inhRelation, bool child_is_partition) |
static int | findAttrByName (const char *attributeName, const List *columns) |
static void | AlterIndexNamespaces (Relation classRel, Relation rel, Oid oldNspOid, Oid newNspOid, ObjectAddresses *objsMoved) |
static void | AlterSeqNamespaces (Relation classRel, Relation rel, Oid oldNspOid, Oid newNspOid, ObjectAddresses *objsMoved, LOCKMODE lockmode) |
static ObjectAddress | ATExecAlterConstraint (Relation rel, AlterTableCmd *cmd, bool recurse, bool recursing, LOCKMODE lockmode) |
static bool | ATExecAlterConstrRecurse (Constraint *cmdcon, Relation conrel, Relation tgrel, Relation rel, HeapTuple contuple, List **otherrelids, LOCKMODE lockmode) |
static ObjectAddress | ATExecValidateConstraint (List **wqueue, Relation rel, char *constrName, bool recurse, bool recursing, LOCKMODE lockmode) |
static int | transformColumnNameList (Oid relId, List *colList, int16 *attnums, Oid *atttypids) |
static int | transformFkeyGetPrimaryKey (Relation pkrel, Oid *indexOid, List **attnamelist, int16 *attnums, Oid *atttypids, Oid *opclasses, bool *pk_has_without_overlaps) |
static Oid | transformFkeyCheckAttrs (Relation pkrel, int numattrs, int16 *attnums, bool with_period, Oid *opclasses, bool *pk_has_without_overlaps) |
static void | checkFkeyPermissions (Relation rel, int16 *attnums, int natts) |
static CoercionPathType | findFkeyCast (Oid targetTypeId, Oid sourceTypeId, Oid *funcid) |
static void | validateForeignKeyConstraint (char *conname, Relation rel, Relation pkrel, Oid pkindOid, Oid constraintOid, bool hasperiod) |
static void | ATController (AlterTableStmt *parsetree, Relation rel, List *cmds, bool recurse, LOCKMODE lockmode, AlterTableUtilityContext *context) |
static void | ATPrepCmd (List **wqueue, Relation rel, AlterTableCmd *cmd, bool recurse, bool recursing, LOCKMODE lockmode, AlterTableUtilityContext *context) |
static void | ATRewriteCatalogs (List **wqueue, LOCKMODE lockmode, AlterTableUtilityContext *context) |
static void | ATExecCmd (List **wqueue, AlteredTableInfo *tab, AlterTableCmd *cmd, LOCKMODE lockmode, AlterTablePass cur_pass, AlterTableUtilityContext *context) |
static AlterTableCmd * | ATParseTransformCmd (List **wqueue, AlteredTableInfo *tab, Relation rel, AlterTableCmd *cmd, bool recurse, LOCKMODE lockmode, AlterTablePass cur_pass, AlterTableUtilityContext *context) |
static void | ATRewriteTables (AlterTableStmt *parsetree, List **wqueue, LOCKMODE lockmode, AlterTableUtilityContext *context) |
static void | ATRewriteTable (AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode) |
static AlteredTableInfo * | ATGetQueueEntry (List **wqueue, Relation rel) |
static void | ATSimplePermissions (AlterTableType cmdtype, Relation rel, int allowed_targets) |
static void | ATSimpleRecursion (List **wqueue, Relation rel, AlterTableCmd *cmd, bool recurse, LOCKMODE lockmode, AlterTableUtilityContext *context) |
static void | ATCheckPartitionsNotInUse (Relation rel, LOCKMODE lockmode) |
static void | ATTypedTableRecursion (List **wqueue, Relation rel, AlterTableCmd *cmd, LOCKMODE lockmode, AlterTableUtilityContext *context) |
static List * | find_typed_table_dependencies (Oid typeOid, const char *typeName, DropBehavior behavior) |
static void | ATPrepAddColumn (List **wqueue, Relation rel, bool recurse, bool recursing, bool is_view, AlterTableCmd *cmd, LOCKMODE lockmode, AlterTableUtilityContext *context) |
static ObjectAddress | ATExecAddColumn (List **wqueue, AlteredTableInfo *tab, Relation rel, AlterTableCmd **cmd, bool recurse, bool recursing, LOCKMODE lockmode, AlterTablePass cur_pass, AlterTableUtilityContext *context) |
static bool | check_for_column_name_collision (Relation rel, const char *colname, bool if_not_exists) |
static void | add_column_datatype_dependency (Oid relid, int32 attnum, Oid typid) |
static void | add_column_collation_dependency (Oid relid, int32 attnum, Oid collid) |
static ObjectAddress | ATExecDropNotNull (Relation rel, const char *colName, bool recurse, LOCKMODE lockmode) |
static bool | set_attnotnull (List **wqueue, Relation rel, AttrNumber attnum, bool recurse, LOCKMODE lockmode) |
static ObjectAddress | ATExecSetNotNull (List **wqueue, Relation rel, char *constrname, char *colName, bool recurse, bool recursing, List **readyRels, LOCKMODE lockmode) |
static ObjectAddress | ATExecSetAttNotNull (List **wqueue, Relation rel, const char *colName, LOCKMODE lockmode) |
static bool | NotNullImpliedByRelConstraints (Relation rel, Form_pg_attribute attr) |
static bool | ConstraintImpliedByRelConstraint (Relation scanrel, List *testConstraint, List *provenConstraint) |
static ObjectAddress | ATExecColumnDefault (Relation rel, const char *colName, Node *newDefault, LOCKMODE lockmode) |
static ObjectAddress | ATExecCookedColumnDefault (Relation rel, AttrNumber attnum, Node *newDefault) |
static ObjectAddress | ATExecAddIdentity (Relation rel, const char *colName, Node *def, LOCKMODE lockmode, bool recurse, bool recursing) |
static ObjectAddress | ATExecSetIdentity (Relation rel, const char *colName, Node *def, LOCKMODE lockmode, bool recurse, bool recursing) |
static ObjectAddress | ATExecDropIdentity (Relation rel, const char *colName, bool missing_ok, LOCKMODE lockmode, bool recurse, bool recursing) |
static ObjectAddress | ATExecSetExpression (AlteredTableInfo *tab, Relation rel, const char *colName, Node *newExpr, LOCKMODE lockmode) |
static void | ATPrepDropExpression (Relation rel, AlterTableCmd *cmd, bool recurse, bool recursing, LOCKMODE lockmode) |
static ObjectAddress | ATExecDropExpression (Relation rel, const char *colName, bool missing_ok, LOCKMODE lockmode) |
static ObjectAddress | ATExecSetStatistics (Relation rel, const char *colName, int16 colNum, Node *newValue, LOCKMODE lockmode) |
static ObjectAddress | ATExecSetOptions (Relation rel, const char *colName, Node *options, bool isReset, LOCKMODE lockmode) |
static ObjectAddress | ATExecSetStorage (Relation rel, const char *colName, Node *newValue, LOCKMODE lockmode) |
static void | ATPrepDropColumn (List **wqueue, Relation rel, bool recurse, bool recursing, AlterTableCmd *cmd, LOCKMODE lockmode, AlterTableUtilityContext *context) |
static ObjectAddress | ATExecDropColumn (List **wqueue, Relation rel, const char *colName, DropBehavior behavior, bool recurse, bool recursing, bool missing_ok, LOCKMODE lockmode, ObjectAddresses *addrs) |
static void | ATPrepAddPrimaryKey (List **wqueue, Relation rel, AlterTableCmd *cmd, LOCKMODE lockmode, AlterTableUtilityContext *context) |
static ObjectAddress | ATExecAddIndex (AlteredTableInfo *tab, Relation rel, IndexStmt *stmt, bool is_rebuild, LOCKMODE lockmode) |
static ObjectAddress | ATExecAddStatistics (AlteredTableInfo *tab, Relation rel, CreateStatsStmt *stmt, bool is_rebuild, LOCKMODE lockmode) |
static ObjectAddress | ATExecAddConstraint (List **wqueue, AlteredTableInfo *tab, Relation rel, Constraint *newConstraint, bool recurse, bool is_readd, LOCKMODE lockmode) |
static char * | ChooseForeignKeyConstraintNameAddition (List *colnames) |
static ObjectAddress | ATExecAddIndexConstraint (AlteredTableInfo *tab, Relation rel, IndexStmt *stmt, LOCKMODE lockmode) |
static ObjectAddress | ATAddCheckNNConstraint (List **wqueue, AlteredTableInfo *tab, Relation rel, Constraint *constr, bool recurse, bool recursing, bool is_readd, LOCKMODE lockmode) |
static ObjectAddress | ATAddForeignKeyConstraint (List **wqueue, AlteredTableInfo *tab, Relation rel, Constraint *fkconstraint, bool recurse, bool recursing, LOCKMODE lockmode) |
static ObjectAddress | addFkRecurseReferenced (List **wqueue, Constraint *fkconstraint, Relation rel, Relation pkrel, Oid indexOid, Oid parentConstr, int numfks, int16 *pkattnum, int16 *fkattnum, Oid *pfeqoperators, Oid *ppeqoperators, Oid *ffeqoperators, int numfkdelsetcols, int16 *fkdelsetcols, bool old_check_ok, Oid parentDelTrigger, Oid parentUpdTrigger, bool with_period) |
static void | validateFkOnDeleteSetColumns (int numfks, const int16 *fkattnums, int numfksetcols, const int16 *fksetcolsattnums, List *fksetcols) |
static void | addFkRecurseReferencing (List **wqueue, Constraint *fkconstraint, Relation rel, Relation pkrel, Oid indexOid, Oid parentConstr, int numfks, int16 *pkattnum, int16 *fkattnum, Oid *pfeqoperators, Oid *ppeqoperators, Oid *ffeqoperators, int numfkdelsetcols, int16 *fkdelsetcols, bool old_check_ok, LOCKMODE lockmode, Oid parentInsTrigger, Oid parentUpdTrigger, bool with_period) |
static void | CloneForeignKeyConstraints (List **wqueue, Relation parentRel, Relation partitionRel) |
static void | CloneFkReferenced (Relation parentRel, Relation partitionRel) |
static void | CloneFkReferencing (List **wqueue, Relation parentRel, Relation partRel) |
static void | createForeignKeyCheckTriggers (Oid myRelOid, Oid refRelOid, Constraint *fkconstraint, Oid constraintOid, Oid indexOid, Oid parentInsTrigger, Oid parentUpdTrigger, Oid *insertTrigOid, Oid *updateTrigOid) |
static void | createForeignKeyActionTriggers (Relation rel, Oid refRelOid, Constraint *fkconstraint, Oid constraintOid, Oid indexOid, Oid parentDelTrigger, Oid parentUpdTrigger, Oid *deleteTrigOid, Oid *updateTrigOid) |
static bool | tryAttachPartitionForeignKey (ForeignKeyCacheInfo *fk, Oid partRelid, Oid parentConstrOid, int numfks, AttrNumber *mapped_conkey, AttrNumber *confkey, Oid *conpfeqop, Oid parentInsTrigger, Oid parentUpdTrigger, Relation trigrel) |
static void | GetForeignKeyActionTriggers (Relation trigrel, Oid conoid, Oid confrelid, Oid conrelid, Oid *deleteTriggerOid, Oid *updateTriggerOid) |
static void | GetForeignKeyCheckTriggers (Relation trigrel, Oid conoid, Oid confrelid, Oid conrelid, Oid *insertTriggerOid, Oid *updateTriggerOid) |
static void | ATExecDropConstraint (Relation rel, const char *constrName, DropBehavior behavior, bool recurse, bool missing_ok, LOCKMODE lockmode) |
static ObjectAddress | dropconstraint_internal (Relation rel, HeapTuple constraintTup, DropBehavior behavior, bool recurse, bool recursing, bool missing_ok, List **readyRels, LOCKMODE lockmode) |
static void | ATPrepAlterColumnType (List **wqueue, AlteredTableInfo *tab, Relation rel, bool recurse, bool recursing, AlterTableCmd *cmd, LOCKMODE lockmode, AlterTableUtilityContext *context) |
static bool | ATColumnChangeRequiresRewrite (Node *expr, AttrNumber varattno) |
static ObjectAddress | ATExecAlterColumnType (AlteredTableInfo *tab, Relation rel, AlterTableCmd *cmd, LOCKMODE lockmode) |
static void | RememberAllDependentForRebuilding (AlteredTableInfo *tab, AlterTableType subtype, Relation rel, AttrNumber attnum, const char *colName) |
static void | RememberConstraintForRebuilding (Oid conoid, AlteredTableInfo *tab) |
static void | RememberIndexForRebuilding (Oid indoid, AlteredTableInfo *tab) |
static void | RememberStatisticsForRebuilding (Oid stxoid, AlteredTableInfo *tab) |
static void | ATPostAlterTypeCleanup (List **wqueue, AlteredTableInfo *tab, LOCKMODE lockmode) |
static void | ATPostAlterTypeParse (Oid oldId, Oid oldRelId, Oid refRelId, char *cmd, List **wqueue, LOCKMODE lockmode, bool rewrite) |
static void | RebuildConstraintComment (AlteredTableInfo *tab, AlterTablePass pass, Oid objid, Relation rel, List *domname, const char *conname) |
static void | TryReuseIndex (Oid oldId, IndexStmt *stmt) |
static void | TryReuseForeignKey (Oid oldId, Constraint *con) |
static ObjectAddress | ATExecAlterColumnGenericOptions (Relation rel, const char *colName, List *options, LOCKMODE lockmode) |
static void | change_owner_fix_column_acls (Oid relationOid, Oid oldOwnerId, Oid newOwnerId) |
static void | change_owner_recurse_to_sequences (Oid relationOid, Oid newOwnerId, LOCKMODE lockmode) |
static ObjectAddress | ATExecClusterOn (Relation rel, const char *indexName, LOCKMODE lockmode) |
static void | ATExecDropCluster (Relation rel, LOCKMODE lockmode) |
static void | ATPrepSetAccessMethod (AlteredTableInfo *tab, Relation rel, const char *amname) |
static void | ATExecSetAccessMethodNoStorage (Relation rel, Oid newAccessMethod) |
static bool | ATPrepChangePersistence (Relation rel, bool toLogged) |
static void | ATPrepSetTableSpace (AlteredTableInfo *tab, Relation rel, const char *tablespacename, LOCKMODE lockmode) |
static void | ATExecSetTableSpace (Oid tableOid, Oid newTableSpace, LOCKMODE lockmode) |
static void | ATExecSetTableSpaceNoStorage (Relation rel, Oid newTableSpace) |
static void | ATExecSetRelOptions (Relation rel, List *defList, AlterTableType operation, LOCKMODE lockmode) |
static void | ATExecEnableDisableTrigger (Relation rel, const char *trigname, char fires_when, bool skip_system, bool recurse, LOCKMODE lockmode) |
static void | ATExecEnableDisableRule (Relation rel, const char *rulename, char fires_when, LOCKMODE lockmode) |
static void | ATPrepAddInherit (Relation child_rel) |
static ObjectAddress | ATExecAddInherit (Relation child_rel, RangeVar *parent, LOCKMODE lockmode) |
static ObjectAddress | ATExecDropInherit (Relation rel, RangeVar *parent, LOCKMODE lockmode) |
static void | drop_parent_dependency (Oid relid, Oid refclassid, Oid refobjid, DependencyType deptype) |
static ObjectAddress | ATExecAddOf (Relation rel, const TypeName *ofTypename, LOCKMODE lockmode) |
static void | ATExecDropOf (Relation rel, LOCKMODE lockmode) |
static void | ATExecReplicaIdentity (Relation rel, ReplicaIdentityStmt *stmt, LOCKMODE lockmode) |
static void | ATExecGenericOptions (Relation rel, List *options) |
static void | ATExecSetRowSecurity (Relation rel, bool rls) |
static void | ATExecForceNoForceRowSecurity (Relation rel, bool force_rls) |
static ObjectAddress | ATExecSetCompression (Relation rel, const char *column, Node *newValue, LOCKMODE lockmode) |
static void | index_copy_data (Relation rel, RelFileLocator newrlocator) |
static const char * | storage_name (char c) |
static void | RangeVarCallbackForDropRelation (const RangeVar *rel, Oid relOid, Oid oldRelOid, void *arg) |
static void | RangeVarCallbackForAlterRelation (const RangeVar *rv, Oid relid, Oid oldrelid, void *arg) |
static PartitionSpec * | transformPartitionSpec (Relation rel, PartitionSpec *partspec) |
static void | ComputePartitionAttrs (ParseState *pstate, Relation rel, List *partParams, AttrNumber *partattrs, List **partexprs, Oid *partopclass, Oid *partcollation, PartitionStrategy strategy) |
static void | CreateInheritance (Relation child_rel, Relation parent_rel, bool ispartition) |
static void | RemoveInheritance (Relation child_rel, Relation parent_rel, bool expect_detached) |
static void | ATInheritAdjustNotNulls (Relation parent_rel, Relation child_rel, int inhcount) |
static ObjectAddress | ATExecAttachPartition (List **wqueue, Relation rel, PartitionCmd *cmd, AlterTableUtilityContext *context) |
static void | AttachPartitionEnsureIndexes (List **wqueue, Relation rel, Relation attachrel) |
static void | QueuePartitionConstraintValidation (List **wqueue, Relation scanrel, List *partConstraint, bool validate_default) |
static void | CloneRowTriggersToPartition (Relation parent, Relation partition) |
static void | DetachAddConstraintIfNeeded (List **wqueue, Relation partRel) |
static void | DropClonedTriggersFromPartition (Oid partitionId) |
static ObjectAddress | ATExecDetachPartition (List **wqueue, AlteredTableInfo *tab, Relation rel, RangeVar *name, bool concurrent) |
static void | DetachPartitionFinalize (Relation rel, Relation partRel, bool concurrent, Oid defaultPartOid) |
static ObjectAddress | ATExecDetachPartitionFinalize (Relation rel, RangeVar *name) |
static ObjectAddress | ATExecAttachPartitionIdx (List **wqueue, Relation parentIdx, RangeVar *name) |
static void | validatePartitionedIndex (Relation partedIdx, Relation partedTbl) |
static void | refuseDupeIndexAttach (Relation parentIdx, Relation partIdx, Relation partitionTbl) |
static void | verifyPartitionIndexNotNull (IndexInfo *iinfo, Relation partIdx) |
static List * | GetParentedForeignKeyRefs (Relation partition) |
static void | ATDetachCheckNoForeignKeyRefs (Relation partition) |
static char | GetAttributeCompression (Oid atttypid, const char *compression) |
static char | GetAttributeStorage (Oid atttypid, const char *storagemode) |
static void | ATExecSplitPartition (List **wqueue, AlteredTableInfo *tab, Relation rel, PartitionCmd *cmd, AlterTableUtilityContext *context) |
static void | ATExecMergePartitions (List **wqueue, AlteredTableInfo *tab, Relation rel, PartitionCmd *cmd, AlterTableUtilityContext *context) |
ObjectAddress | DefineRelation (CreateStmt *stmt, char relkind, Oid ownerId, ObjectAddress *typaddress, const char *queryString) |
TupleDesc | BuildDescForRelation (const List *columns) |
static void | DropErrorMsgNonExistent (RangeVar *rel, char rightkind, bool missing_ok) |
static void | DropErrorMsgWrongType (const char *relname, char wrongkind, char rightkind) |
void | RemoveRelations (DropStmt *drop) |
void | ExecuteTruncate (TruncateStmt *stmt) |
void | ExecuteTruncateGuts (List *explicit_rels, List *relids, List *relids_logged, DropBehavior behavior, bool restart_seqs, bool run_as_table_owner) |
void | SetRelationHasSubclass (Oid relationId, bool relhassubclass) |
bool | CheckRelationTableSpaceMove (Relation rel, Oid newTableSpaceId) |
void | SetRelationTableSpace (Relation rel, Oid newTableSpaceId, RelFileNumber newRelFilenumber) |
static void | renameatt_check (Oid myrelid, Form_pg_class classform, bool recursing) |
static AttrNumber | renameatt_internal (Oid myrelid, const char *oldattname, const char *newattname, bool recurse, bool recursing, int expected_parents, DropBehavior behavior) |
static void | RangeVarCallbackForRenameAttribute (const RangeVar *rv, Oid relid, Oid oldrelid, void *arg) |
ObjectAddress | renameatt (RenameStmt *stmt) |
static ObjectAddress | rename_constraint_internal (Oid myrelid, Oid mytypid, const char *oldconname, const char *newconname, bool recurse, bool recursing, int expected_parents) |
ObjectAddress | RenameConstraint (RenameStmt *stmt) |
ObjectAddress | RenameRelation (RenameStmt *stmt) |
void | RenameRelationInternal (Oid myrelid, const char *newrelname, bool is_internal, bool is_index) |
void | ResetRelRewrite (Oid myrelid) |
void | CheckTableNotInUse (Relation rel, const char *stmt) |
Oid | AlterTableLookupRelation (AlterTableStmt *stmt, LOCKMODE lockmode) |
void | AlterTable (AlterTableStmt *stmt, LOCKMODE lockmode, AlterTableUtilityContext *context) |
void | AlterTableInternal (Oid relid, List *cmds, bool recurse) |
LOCKMODE | AlterTableGetLockLevel (List *cmds) |
static const char * | alter_table_type_to_string (AlterTableType cmdtype) |
void | find_composite_type_dependencies (Oid typeOid, Relation origRelation, const char *origTypeName) |
void | check_of_type (HeapTuple typetuple) |
static void | SetIndexStorageProperties (Relation rel, Relation attrelation, AttrNumber attnum, bool setstorage, char newstorage, bool setcompression, char newcompression, LOCKMODE lockmode) |
static Oid | CreateFKCheckTrigger (Oid myRelOid, Oid refRelOid, Constraint *fkconstraint, Oid constraintOid, Oid indexOid, Oid parentTrigOid, bool on_insert) |
static void | RememberReplicaIdentityForRebuilding (Oid indoid, AlteredTableInfo *tab) |
static void | RememberClusterOnForRebuilding (Oid indoid, AlteredTableInfo *tab) |
void | ATExecChangeOwner (Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lockmode) |
Oid | AlterTableMoveAll (AlterTableMoveAllStmt *stmt) |
static char * | decompile_conbin (HeapTuple contup, TupleDesc tupdesc) |
static bool | constraints_equivalent (HeapTuple a, HeapTuple b, TupleDesc tupleDesc) |
static void | MarkInheritDetached (Relation child_rel, Relation parent_rel) |
static void | relation_mark_replica_identity (Relation rel, char ri_type, Oid indexOid, bool is_internal) |
ObjectAddress | AlterTableNamespace (AlterObjectSchemaStmt *stmt, Oid *oldschema) |
void | AlterTableNamespaceInternal (Relation rel, Oid oldNspOid, Oid nspOid, ObjectAddresses *objsMoved) |
void | AlterRelationNamespaceInternal (Relation classRel, Oid relOid, Oid oldNspOid, Oid newNspOid, bool hasDependEntry, ObjectAddresses *objsMoved) |
void | register_on_commit_action (Oid relid, OnCommitAction action) |
void | remove_on_commit_action (Oid relid) |
void | PreCommit_on_commit_actions (void) |
void | AtEOXact_on_commit_actions (bool isCommit) |
void | AtEOSubXact_on_commit_actions (bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid) |
void | RangeVarCallbackMaintainsTable (const RangeVar *relation, Oid relId, Oid oldRelId, void *arg) |
void | RangeVarCallbackOwnsRelation (const RangeVar *relation, Oid relId, Oid oldRelId, void *arg) |
bool | PartConstraintImpliedByRelConstraint (Relation scanrel, List *partConstraint) |
static void | attachPartitionTable (List **wqueue, Relation rel, Relation attachrel, PartitionBoundSpec *bound) |
static void | RangeVarCallbackForAttachIndex (const RangeVar *rv, Oid relOid, Oid oldRelOid, void *arg) |
static SplitPartitionContext * | createSplitPartitionContext (Relation partRel) |
static void | deleteSplitPartitionContext (SplitPartitionContext *pc, int ti_options) |
static void | moveSplitTableRows (Relation rel, Relation splitRel, List *partlist, List *newPartRels, Oid defaultPartOid) |
static void | createPartitionTable (RangeVar *newPartName, RangeVar *modelRelName, AlterTableUtilityContext *context) |
static void | moveMergedTablesRows (Relation rel, List *mergingPartitionsList, Relation newPartRel) |
Variables | |
static List * | on_commits = NIL |
static const struct dropmsgstrings | dropmsgstringarray [] |
#define AT_NUM_PASSES (AT_PASS_MISC + 1) |
Definition at line 165 of file tablecmds.c.
#define ATT_COMPOSITE_TYPE 0x0010 |
Definition at line 331 of file tablecmds.c.
#define ATT_FOREIGN_TABLE 0x0020 |
Definition at line 332 of file tablecmds.c.
#define ATT_INDEX 0x0008 |
Definition at line 330 of file tablecmds.c.
#define ATT_MATVIEW 0x0004 |
Definition at line 329 of file tablecmds.c.
#define ATT_PARTITIONED_INDEX 0x0040 |
Definition at line 333 of file tablecmds.c.
#define ATT_SEQUENCE 0x0080 |
Definition at line 334 of file tablecmds.c.
#define ATT_TABLE 0x0001 |
Definition at line 327 of file tablecmds.c.
#define ATT_VIEW 0x0002 |
Definition at line 328 of file tablecmds.c.
#define child_dependency_type | ( | child_is_partition | ) | ((child_is_partition) ? DEPENDENCY_AUTO : DEPENDENCY_NORMAL) |
Definition at line 355 of file tablecmds.c.
typedef struct AlteredTableInfo AlteredTableInfo |
typedef enum AlterTablePass AlterTablePass |
typedef struct ForeignTruncateInfo ForeignTruncateInfo |
typedef struct NewColumnValue NewColumnValue |
typedef struct NewConstraint NewConstraint |
typedef struct OnCommitItem OnCommitItem |
typedef struct SplitPartitionContext SplitPartitionContext |
enum AlterTablePass |
Definition at line 146 of file tablecmds.c.
Definition at line 7546 of file tablecmds.c.
References attnum, ObjectAddress::classId, collid, DEPENDENCY_NORMAL, ObjectAddress::objectId, ObjectAddress::objectSubId, OidIsValid, and recordDependencyOn().
Referenced by ATExecAddColumn(), and ATExecAlterColumnType().
Definition at line 7528 of file tablecmds.c.
References attnum, ObjectAddress::classId, DEPENDENCY_NORMAL, ObjectAddress::objectId, ObjectAddress::objectSubId, and recordDependencyOn().
Referenced by ATExecAddColumn(), and ATExecAlterColumnType().
|
static |
Definition at line 10483 of file tablecmds.c.
References AttrMap::attnums, build_attrmap_by_name_if_req(), ChooseConstraintName(), ChooseForeignKeyConstraintNameAddition(), CommandCounterIncrement(), Constraint::conname, CONSTRAINT_RELATION, ConstraintNameIsUsed(), CreateConstraintEntry(), createForeignKeyActionTriggers(), Constraint::deferrable, DEPENDENCY_INTERNAL, elog, ereport, errcode(), errmsg(), ERROR, Constraint::fk_attrs, Constraint::fk_del_action, Constraint::fk_matchtype, Constraint::fk_upd_action, free_attrmap(), i, index_get_partition(), Constraint::initdeferred, Constraint::initially_valid, InvalidOid, j, NIL, NoLock, PartitionDescData::nparts, ObjectAddressSet, OidIsValid, PartitionDescData::oids, palloc(), pfree(), RelationData::rd_rel, recordDependencyOn(), RelationGetDescr, RelationGetNamespace, RelationGetPartitionDesc(), RelationGetRelationName, RelationGetRelid, ShareRowExclusiveLock, table_close(), and table_open().
Referenced by ATAddForeignKeyConstraint(), and CloneFkReferenced().
|
static |
Definition at line 10706 of file tablecmds.c.
References Assert, ATGetQueueEntry(), AttrMap::attnums, build_attrmap_by_name(), CheckTableNotInUse(), ChooseConstraintName(), ChooseForeignKeyConstraintNameAddition(), CommandCounterIncrement(), NewConstraint::conid, Constraint::conname, CONSTR_FOREIGN, CONSTRAINT_RELATION, ConstraintNameIsUsed(), AlteredTableInfo::constraints, NewConstraint::contype, NewConstraint::conwithperiod, copyObject, CreateConstraintEntry(), createForeignKeyCheckTriggers(), Constraint::deferrable, DEPENDENCY_PARTITION_PRI, DEPENDENCY_PARTITION_SEC, ereport, errcode(), errmsg(), ERROR, Constraint::fk_attrs, Constraint::fk_del_action, Constraint::fk_matchtype, Constraint::fk_upd_action, Constraint::fk_with_period, get_constraint_name(), i, INDEX_MAX_KEYS, Constraint::initdeferred, Constraint::initially_valid, InvalidOid, j, lappend(), lfirst_node, NewConstraint::name, NIL, NoLock, PartitionDescData::nparts, ObjectAddressSet, OidIsValid, PartitionDescData::oids, palloc0(), NewConstraint::qual, RelationData::rd_rel, recordDependencyOn(), NewConstraint::refindid, NewConstraint::refrelid, RelationGetDescr, RelationGetFKeyList(), RelationGetNamespace, RelationGetPartitionDesc(), RelationGetRelationName, RelationGetRelid, RowExclusiveLock, Constraint::skip_validation, table_close(), table_open(), and tryAttachPartitionForeignKey().
Referenced by ATAddForeignKeyConstraint(), and CloneFkReferencing().
|
static |
Definition at line 6464 of file tablecmds.c.
References AT_AddColumn, AT_AddColumnToView, AT_AddConstraint, AT_AddIdentity, AT_AddIndex, AT_AddIndexConstraint, AT_AddInherit, AT_AddOf, AT_AlterColumnGenericOptions, AT_AlterColumnType, AT_AlterConstraint, AT_AttachPartition, AT_ChangeOwner, AT_ClusterOn, AT_ColumnDefault, AT_CookedColumnDefault, AT_DetachPartition, AT_DetachPartitionFinalize, AT_DisableRowSecurity, AT_DisableRule, AT_DisableTrig, AT_DisableTrigAll, AT_DisableTrigUser, AT_DropCluster, AT_DropColumn, AT_DropConstraint, AT_DropExpression, AT_DropIdentity, AT_DropInherit, AT_DropNotNull, AT_DropOf, AT_DropOids, AT_EnableAlwaysRule, AT_EnableAlwaysTrig, AT_EnableReplicaRule, AT_EnableReplicaTrig, AT_EnableRowSecurity, AT_EnableRule, AT_EnableTrig, AT_EnableTrigAll, AT_EnableTrigUser, AT_ForceRowSecurity, AT_GenericOptions, AT_MergePartitions, AT_NoForceRowSecurity, AT_ReAddComment, AT_ReAddConstraint, AT_ReAddDomainConstraint, AT_ReAddIndex, AT_ReAddStatistics, AT_ReplaceRelOptions, AT_ReplicaIdentity, AT_ResetOptions, AT_ResetRelOptions, AT_SetAccessMethod, AT_SetAttNotNull, AT_SetCompression, AT_SetExpression, AT_SetIdentity, AT_SetLogged, AT_SetNotNull, AT_SetOptions, AT_SetRelOptions, AT_SetStatistics, AT_SetStorage, AT_SetTableSpace, AT_SetUnLogged, AT_SplitPartition, and AT_ValidateConstraint.
Referenced by ATSimplePermissions().
|
static |
Definition at line 18077 of file tablecmds.c.
References add_exact_object_address(), AlterRelationNamespaceInternal(), ObjectAddress::classId, lfirst_oid, list_free(), object_address_present(), ObjectAddress::objectId, ObjectAddress::objectSubId, and RelationGetIndexList().
Referenced by AlterTableNamespaceInternal().
void AlterRelationNamespaceInternal | ( | Relation | classRel, |
Oid | relOid, | ||
Oid | oldNspOid, | ||
Oid | newNspOid, | ||
bool | hasDependEntry, | ||
ObjectAddresses * | objsMoved | ||
) |
Definition at line 18007 of file tablecmds.c.
References add_exact_object_address(), Assert, CatalogTupleUpdate(), changeDependencyFor(), ObjectAddress::classId, elog, ereport, errcode(), errmsg(), ERROR, get_namespace_name(), get_relname_relid(), GETSTRUCT, heap_freetuple(), HeapTupleIsValid, InvalidOid, InvokeObjectPostAlterHook, NameStr, object_address_present(), ObjectAddress::objectId, ObjectIdGetDatum(), ObjectAddress::objectSubId, SearchSysCacheCopy1, and HeapTupleData::t_self.
Referenced by AlterIndexNamespaces(), AlterSeqNamespaces(), AlterTableNamespaceInternal(), and AlterTypeNamespaceInternal().
|
static |
Definition at line 18122 of file tablecmds.c.
References AccessShareLock, AlterRelationNamespaceInternal(), Assert, BTEqualStrategyNumber, DEPENDENCY_AUTO, DEPENDENCY_INTERNAL, GETSTRUCT, HeapTupleIsValid, InvalidOid, sort-test::key, NoLock, ObjectIdGetDatum(), relation_close(), relation_open(), RelationGetForm, RelationGetRelid, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), and table_open().
Referenced by AlterTableNamespaceInternal().
void AlterTable | ( | AlterTableStmt * | stmt, |
LOCKMODE | lockmode, | ||
AlterTableUtilityContext * | context | ||
) |
Definition at line 4434 of file tablecmds.c.
References ATController(), CheckTableNotInUse(), context, NoLock, relation_open(), and stmt.
Referenced by ProcessUtilitySlow().
Definition at line 4508 of file tablecmds.c.
References AccessExclusiveLock, AlterTableGetRelOptionsLockLevel(), AT_AddColumn, AT_AddColumnToView, AT_AddConstraint, AT_AddIdentity, AT_AddIndex, AT_AddIndexConstraint, AT_AddInherit, AT_AddOf, AT_AlterColumnGenericOptions, AT_AlterColumnType, AT_AlterConstraint, AT_AttachPartition, AT_ChangeOwner, AT_ClusterOn, AT_ColumnDefault, AT_CookedColumnDefault, AT_DetachPartition, AT_DetachPartitionFinalize, AT_DisableRowSecurity, AT_DisableRule, AT_DisableTrig, AT_DisableTrigAll, AT_DisableTrigUser, AT_DropCluster, AT_DropColumn, AT_DropConstraint, AT_DropExpression, AT_DropIdentity, AT_DropInherit, AT_DropNotNull, AT_DropOf, AT_DropOids, AT_EnableAlwaysRule, AT_EnableAlwaysTrig, AT_EnableReplicaRule, AT_EnableReplicaTrig, AT_EnableRowSecurity, AT_EnableRule, AT_EnableTrig, AT_EnableTrigAll, AT_EnableTrigUser, AT_ForceRowSecurity, AT_GenericOptions, AT_MergePartitions, AT_NoForceRowSecurity, AT_ReAddConstraint, AT_ReAddDomainConstraint, AT_ReplaceRelOptions, AT_ReplicaIdentity, AT_ResetOptions, AT_ResetRelOptions, AT_SetAccessMethod, AT_SetAttNotNull, AT_SetCompression, AT_SetExpression, AT_SetIdentity, AT_SetLogged, AT_SetNotNull, AT_SetOptions, AT_SetRelOptions, AT_SetStatistics, AT_SetStorage, AT_SetTableSpace, AT_SetUnLogged, AT_SplitPartition, AT_ValidateConstraint, CONSTR_EXCLUSION, CONSTR_FOREIGN, CONSTR_PRIMARY, CONSTR_UNIQUE, Constraint::contype, AlterTableCmd::def, elog, ERROR, IsA, lfirst, ShareRowExclusiveLock, ShareUpdateExclusiveLock, and AlterTableCmd::subtype.
Referenced by AlterTableInternal(), and ProcessUtilitySlow().
Definition at line 4463 of file tablecmds.c.
References AlterTableGetLockLevel(), ATController(), EventTriggerAlterTableRelid(), and relation_open().
Referenced by AlterTableMoveAll(), and DefineVirtualRelation().
Oid AlterTableLookupRelation | ( | AlterTableStmt * | stmt, |
LOCKMODE | lockmode | ||
) |
Definition at line 4375 of file tablecmds.c.
References RangeVarCallbackForAlterRelation(), RangeVarGetRelidExtended(), RVR_MISSING_OK, and stmt.
Referenced by ProcessUtilitySlow().
Oid AlterTableMoveAll | ( | AlterTableMoveAllStmt * | stmt | ) |
Definition at line 15916 of file tablecmds.c.
References AccessExclusiveLock, AccessShareLock, ACL_CREATE, aclcheck_error(), ACLCHECK_NOT_OWNER, ACLCHECK_OK, AlterTableInternal(), AT_SetTableSpace, BTEqualStrategyNumber, ConditionalLockRelationOid(), ereport, errcode(), errmsg(), ERROR, EventTriggerAlterTableEnd(), EventTriggerAlterTableStart(), ForwardScanDirection, get_namespace_name(), get_rel_relkind(), get_relkind_objtype(), get_tablespace_name(), get_tablespace_oid(), GETSTRUCT, GetUserId(), heap_getnext(), InvalidOid, isAnyTempNamespace(), IsCatalogNamespace(), IsToastNamespace(), sort-test::key, lappend(), lappend_oid(), lfirst_oid, list_member_oid(), LockRelationOid(), makeNode, MyDatabaseTableSpace, AlterTableCmd::name, NameStr, NIL, NOTICE, object_aclcheck(), OBJECT_INDEX, OBJECT_MATVIEW, object_ownercheck(), OBJECT_TABLE, OBJECT_TABLESPACE, ObjectIdGetDatum(), OidIsValid, roleSpecsToIds(), ScanKeyInit(), stmt, AlterTableCmd::subtype, table_beginscan_catalog(), table_close(), table_endscan(), and table_open().
Referenced by ProcessUtilitySlow().
ObjectAddress AlterTableNamespace | ( | AlterObjectSchemaStmt * | stmt, |
Oid * | oldschema | ||
) |
Definition at line 17902 of file tablecmds.c.
References AccessExclusiveLock, AlterTableNamespaceInternal(), CheckSetNamespace(), DEPENDENCY_AUTO, DEPENDENCY_INTERNAL, ereport, errcode(), errdetail(), errmsg(), ERROR, free_object_addresses(), get_rel_name(), InvalidObjectAddress, makeRangeVar(), new_object_addresses(), NoLock, NOTICE, ObjectAddressSet, OidIsValid, RangeVarCallbackForAlterRelation(), RangeVarGetAndCheckCreationNamespace(), RangeVarGetRelidExtended(), RelationData::rd_rel, relation_close(), relation_open(), RelationGetNamespace, RelationGetRelationName, RVR_MISSING_OK, sequenceIsOwned(), and stmt.
Referenced by ExecAlterObjectSchemaStmt().
void AlterTableNamespaceInternal | ( | Relation | rel, |
Oid | oldNspOid, | ||
Oid | nspOid, | ||
ObjectAddresses * | objsMoved | ||
) |
Definition at line 17973 of file tablecmds.c.
References AccessExclusiveLock, AlterConstraintNamespaces(), AlterIndexNamespaces(), AlterRelationNamespaceInternal(), AlterSeqNamespaces(), AlterTypeNamespaceInternal(), Assert, OidIsValid, RelationData::rd_rel, RelationGetRelid, RowExclusiveLock, table_close(), and table_open().
Referenced by AlterObjectNamespace_oid(), and AlterTableNamespace().
|
static |
Definition at line 9729 of file tablecmds.c.
References AddRelationNewConstraints(), Assert, AT_AddConstraint, ATGetQueueEntry(), ATSimplePermissions(), ATT_FOREIGN_TABLE, ATT_TABLE, CookedConstraint::attnum, check_stack_depth(), CheckTableNotInUse(), CommandCounterIncrement(), Constraint::conname, CookedConstraint::conoid, CONSTR_NOTNULL, AlteredTableInfo::constraints, NewConstraint::contype, CookedConstraint::contype, Constraint::contype, copyObject, ereport, errcode(), errmsg(), ERROR, CookedConstraint::expr, find_inheritance_children(), Constraint::inhcount, InvalidObjectAddress, CookedConstraint::is_no_inherit, Constraint::is_no_inherit, lappend(), lfirst, lfirst_oid, list_length(), list_make1, NewConstraint::name, CookedConstraint::name, NIL, NoLock, ObjectAddressSet, palloc0(), NewConstraint::qual, RelationGetRelid, set_attnotnull(), CookedConstraint::skip_validation, table_close(), and table_open().
Referenced by ATExecAddConstraint(), and DetachAddConstraintIfNeeded().
|
static |
Definition at line 9887 of file tablecmds.c.
References addFkRecurseReferenced(), addFkRecurseReferencing(), allowSystemTableMods, Assert, BTEqualStrategyNumber, can_coerce_type(), checkFkeyPermissions(), COERCION_IMPLICIT, Constraint::conname, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, findFkeyCast(), FindFKPeriodOpers(), Constraint::fk_attrs, Constraint::fk_del_action, Constraint::fk_del_set_cols, Constraint::fk_upd_action, Constraint::fk_with_period, FKCONSTR_ACTION_CASCADE, FKCONSTR_ACTION_SETDEFAULT, FKCONSTR_ACTION_SETNULL, format_type_be(), get_opfamily_member(), getBaseType(), GETSTRUCT, GistTranslateStratnum(), HeapTupleIsValid, i, INDEX_MAX_KEYS, Constraint::initially_valid, InvalidOid, InvalidStrategy, IsSystemRelation(), lfirst_oid, list_head(), list_length(), list_nth(), lnext(), NameStr, NIL, NoLock, ObjectAddress::objectId, ObjectIdGetDatum(), OidIsValid, Constraint::old_conpfeqop, Constraint::old_pktable_oid, AlteredTableInfo::oldDesc, Constraint::pk_attrs, Constraint::pk_with_period, Constraint::pktable, RelationData::rd_islocaltemp, RelationData::rd_rel, RelationGetDescr, RelationGetRelationName, RelationGetRelid, RelationIsPermanent, ReleaseSysCache(), RTEqualStrategyNumber, RTOverlapStrategyNumber, SearchSysCache1(), ShareRowExclusiveLock, Constraint::skip_validation, strVal, table_close(), table_open(), table_openrv(), transformColumnNameList(), transformFkeyCheckAttrs(), transformFkeyGetPrimaryKey(), TupleDescAttr, and validateFkOnDeleteSetColumns().
Referenced by ATExecAddConstraint().
Definition at line 6733 of file tablecmds.c.
References CheckTableNotInUse(), find_all_inheritors(), for_each_from, lfirst_oid, list_free(), NoLock, RelationData::rd_rel, RelationGetRelid, table_close(), and table_open().
Referenced by ATPrepCmd().
|
static |
Definition at line 13663 of file tablecmds.c.
References arg, CoerceToDomain::arg, FuncExpr::args, Assert, DomainHasConstraints(), FuncExpr::funcid, IsA, linitial, CoerceToDomain::resulttype, and TimestampTimestampTzRequiresRewrite().
Referenced by ATPrepAlterColumnType().
|
static |
Definition at line 4779 of file tablecmds.c.
References ATPrepCmd(), ATRewriteCatalogs(), ATRewriteTables(), context, lfirst, NIL, NoLock, and relation_close().
Referenced by AlterTable(), and AlterTableInternal().
|
static |
Definition at line 20840 of file tablecmds.c.
References Assert, elog, ERROR, GetParentedForeignKeyRefs(), GETSTRUCT, HeapTupleIsValid, InvalidOid, lfirst_oid, NameStr, NoLock, ObjectIdGetDatum(), OidIsValid, RelationGetRelid, ReleaseSysCache(), RI_PartitionRemove_Check(), SearchSysCache1(), ShareLock, table_close(), table_open(), Trigger::tgconstraint, Trigger::tgconstrindid, Trigger::tgconstrrelid, Trigger::tgdeferrable, Trigger::tgenabled, Trigger::tginitdeferred, Trigger::tgisinternal, Trigger::tgname, Trigger::tgoid, and TRIGGER_FIRES_ON_ORIGIN.
Referenced by ATExecDetachPartition().
void AtEOSubXact_on_commit_actions | ( | bool | isCommit, |
SubTransactionId | mySubid, | ||
SubTransactionId | parentSubid | ||
) |
Definition at line 18405 of file tablecmds.c.
References OnCommitItem::creating_subid, OnCommitItem::deleting_subid, foreach_delete_current, InvalidSubTransactionId, lfirst, on_commits, and pfree().
Referenced by AbortSubTransaction(), and CommitSubTransaction().
void AtEOXact_on_commit_actions | ( | bool | isCommit | ) |
Definition at line 18373 of file tablecmds.c.
References OnCommitItem::creating_subid, OnCommitItem::deleting_subid, foreach_delete_current, InvalidSubTransactionId, lfirst, on_commits, and pfree().
Referenced by AbortTransaction(), CommitTransaction(), and PrepareTransaction().
|
static |
Definition at line 7082 of file tablecmds.c.
References add_column_collation_dependency(), add_column_datatype_dependency(), AddRelationNewConstraints(), Assert, AT_REWRITE_DEFAULT_VAL, ATGetQueueEntry(), ATParseTransformCmd(), ATSimplePermissions(), ATT_FOREIGN_TABLE, ATT_TABLE, RawColumnDefault::attnum, build_column_default(), BuildDescForRelation(), castNode, CatalogTupleUpdate(), check_for_column_name_collision(), check_stack_depth(), CheckAttributeType(), CheckTableNotInUse(), COERCE_IMPLICIT_CAST, coerce_to_target_type(), COERCION_ASSIGNMENT, ColumnDef::colname, CommandCounterIncrement(), context, copyObject, AlterTableCmd::def, DomainHasConstraints(), elog, ereport, errcode(), errdetail(), errmsg(), ERROR, expression_planner(), find_inheritance_children(), RawColumnDefault::generated, ColumnDef::generated, get_collation_name(), get_typcollation(), getBaseTypeAndTypmod(), GetColumnDefCollation(), GETSTRUCT, heap_freetuple(), HeapTupleIsValid, ColumnDef::identity, ColumnDef::identitySequence, ColumnDef::inhcount, InsertPgAttributeTuples(), InvalidObjectAddress, InvokeObjectPostCreateHook, ColumnDef::is_local, ColumnDef::is_not_null, lappend(), lfirst_oid, list_make1, list_make1_oid, makeNode, makeNullConst(), MaxHeapAttributeNumber, RawColumnDefault::missingMode, NameStr, newval, AlteredTableInfo::newvals, NIL, NoLock, NOTICE, ObjectAddressSubSet, ObjectIdGetDatum(), palloc(), palloc0(), RangeVarGetRelid, RawColumnDefault::raw_default, ColumnDef::raw_default, RelationData::rd_att, RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, AlteredTableInfo::rewrite, RowExclusiveLock, SearchSysCacheCopy1, SearchSysCacheCopyAttName(), NextValueExpr::seqid, HeapTupleData::t_self, table_close(), table_open(), TupleDescAttr, NextValueExpr::typeId, ColumnDef::typeName, typenameTypeIdAndMod(), and AlteredTableInfo::verify_new_notnull.
Referenced by ATExecCmd().
|
static |
Definition at line 9613 of file tablecmds.c.
References Assert, ATAddCheckNNConstraint(), ATAddForeignKeyConstraint(), ChooseConstraintName(), ChooseForeignKeyConstraintNameAddition(), Constraint::conname, CONSTR_CHECK, CONSTR_FOREIGN, CONSTR_NOTNULL, CONSTRAINT_RELATION, ConstraintNameIsUsed(), Constraint::contype, elog, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errmsg(), ERROR, Constraint::fk_attrs, InvalidObjectAddress, IsA, NIL, RelationGetNamespace, RelationGetRelationName, and RelationGetRelid.
Referenced by ATExecCmd().
|
static |
Definition at line 8202 of file tablecmds.c.
References attnum, castNode, CatalogTupleUpdate(), ereport, errcode(), errhint(), errmsg(), ERROR, find_inheritance_children(), GETSTRUCT, heap_freetuple(), HeapTupleIsValid, ColumnDef::identity, InvokeObjectPostAlterHook, lfirst_oid, NoLock, ObjectAddressSubSet, RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, SearchSysCacheCopyAttName(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecCmd().
|
static |
Definition at line 9437 of file tablecmds.c.
References Assert, DefineIndex(), index_close(), index_open(), InvalidOid, IsA, NoLock, ObjectAddress::objectId, RelationData::rd_createSubid, RelationData::rd_firstRelfilelocatorSubid, RelationData::rd_locator, RelationGetRelid, RelationPreserveStorage(), RelFileNumberIsValid, AlteredTableInfo::rewrite, and stmt.
Referenced by ATExecCmd().
|
static |
Definition at line 9521 of file tablecmds.c.
References AccessShareLock, allowSystemTableMods, Assert, BuildIndexInfo(), elog, ereport, errcode(), errmsg(), ERROR, IndexInfo::ii_Unique, index_check_primary_key(), index_close(), INDEX_CONSTR_CREATE_DEFERRABLE, INDEX_CONSTR_CREATE_INIT_DEFERRED, INDEX_CONSTR_CREATE_MARK_AS_PRIMARY, INDEX_CONSTR_CREATE_REMOVE_OLD_DEPS, INDEX_CONSTR_CREATE_UPDATE_INDEX, index_constraint_create(), index_open(), InvalidOid, IsA, NoLock, NOTICE, OidIsValid, pstrdup(), RelationData::rd_rel, RelationGetRelationName, RenameRelationInternal(), and stmt.
Referenced by ATExecCmd().
|
static |
Definition at line 16192 of file tablecmds.c.
References AccessShareLock, AT_AddInherit, ATInheritAdjustNotNulls(), ATSimplePermissions(), ATT_FOREIGN_TABLE, ATT_TABLE, CreateInheritance(), ereport, errcode(), errdetail(), errmsg(), ERROR, find_all_inheritors(), FindTriggerIncompatibleWithInheritance(), list_member_oid(), NoLock, ObjectAddressSet, RelationData::rd_islocaltemp, RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, RangeVar::relname, ShareUpdateExclusiveLock, table_close(), table_openrv(), and RelationData::trigdesc.
Referenced by ATExecCmd().
|
static |
Definition at line 17181 of file tablecmds.c.
References AccessShareLock, BTEqualStrategyNumber, CatalogTupleUpdate(), check_of_type(), ObjectAddress::classId, DEPENDENCY_NORMAL, drop_parent_dependency(), elog, ereport, errcode(), errmsg(), ERROR, GETSTRUCT, heap_freetuple(), HeapTupleIsValid, InvokeObjectPostAlterHook, sort-test::key, lookup_rowtype_tupdesc(), NAMEDATALEN, NameStr, TupleDescData::natts, ObjectAddress::objectId, ObjectIdGetDatum(), ObjectAddress::objectSubId, RelationData::rd_rel, recordDependencyOn(), RelationGetDescr, RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), ReleaseTupleDesc, RowExclusiveLock, ScanKeyInit(), SearchSysCacheCopy1, systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), table_open(), TupleDescAttr, and typenameType().
Referenced by ATExecCmd().
|
static |
Definition at line 9500 of file tablecmds.c.
References Assert, CreateStatistics(), IsA, and stmt.
Referenced by ATExecCmd().
|
static |
Definition at line 14891 of file tablecmds.c.
References AccessShareLock, attnum, CatalogTupleUpdate(), DatumGetPointer(), ereport, errcode(), errmsg(), ERROR, ForeignServer::fdwid, ForeignDataWrapper::fdwvalidator, GetForeignDataWrapper(), GetForeignServer(), GETSTRUCT, heap_freetuple(), heap_modify_tuple(), HeapTupleIsValid, InvalidObjectAddress, InvokeObjectPostAlterHook, NIL, ObjectAddressSubSet, ObjectIdGetDatum(), PointerGetDatum(), PointerIsValid, RelationData::rd_id, RelationGetDescr, RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), RowExclusiveLock, SearchSysCache1(), SearchSysCacheAttName(), SysCacheGetAttr(), HeapTupleData::t_self, table_close(), table_open(), and transformGenericOptions().
Referenced by ATExecCmd().
|
static |
Definition at line 13710 of file tablecmds.c.
References add_column_collation_dependency(), add_column_datatype_dependency(), array_get_element(), Assert, AT_AlterColumnType, attnum, BTEqualStrategyNumber, build_column_default(), CatalogTupleDelete(), CatalogTupleUpdate(), ObjectAddress::classId, COERCE_IMPLICIT_CAST, coerce_to_target_type(), COERCION_ASSIGNMENT, CommandCounterIncrement(), construct_array(), AlterTableCmd::def, deleteDependencyRecordsFor(), DEPENDENCY_NORMAL, DROP_RESTRICT, elog, ereport, errcode(), errmsg(), ERROR, exprType(), format_type_be(), GetAttrDefaultOid(), GetColumnDefCollation(), getObjectDescription(), GETSTRUCT, heap_freetuple(), heap_getattr(), heap_modify_tuple(), HeapTupleIsValid, if(), Int32GetDatum(), InvalidCompressionMethod, InvokeObjectPostAlterHook, sort-test::key, list_length(), AlterTableCmd::name, NoLock, ObjectAddressSubSet, ObjectAddress::objectId, ObjectIdGetDatum(), ObjectAddress::objectSubId, OidIsValid, AlteredTableInfo::oldDesc, PG_INT16_MAX, PointerGetDatum(), relation_close(), RelationClearMissing(), RelationGetDescr, RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), RememberAllDependentForRebuilding(), RemoveAttrDefault(), RemoveStatistics(), AlteredTableInfo::rewrite, RowExclusiveLock, ScanKeyInit(), SearchSysCacheCopyAttName(), StoreAttrDefault(), strip_implicit_coercions(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), TupleDescAttr, ColumnDef::typeName, and typenameType().
Referenced by ATExecCmd().
|
static |
Definition at line 11713 of file tablecmds.c.
References ATExecAlterConstrRecurse(), BTEqualStrategyNumber, CacheInvalidateRelcacheByRelid(), castNode, Constraint::conname, CStringGetDatum(), AlterTableCmd::def, Constraint::deferrable, ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, get_rel_name(), GETSTRUCT, HeapTupleIsValid, Constraint::initdeferred, InvalidObjectAddress, InvalidOid, lfirst_oid, NameStr, NIL, ObjectAddressSet, ObjectIdGetDatum(), OidIsValid, pstrdup(), RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), RowExclusiveLock, ScanKeyInit(), SearchSysCache1(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by ATExecCmd().
|
static |
Definition at line 11850 of file tablecmds.c.
References BTEqualStrategyNumber, CacheInvalidateRelcache(), CatalogTupleUpdate(), check_stack_depth(), Constraint::deferrable, get_rel_relkind(), GETSTRUCT, heap_copytuple(), heap_freetuple(), HeapTupleIsValid, Constraint::initdeferred, InvokeObjectPostAlterHook, list_append_unique_oid(), NoLock, ObjectIdGetDatum(), RelationData::rd_rel, RelationGetRelid, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecAlterConstraint().
|
static |
Definition at line 19203 of file tablecmds.c.
References AccessExclusiveLock, AccessShareLock, Assert, AT_AttachPartition, ATSimplePermissions(), ATT_FOREIGN_TABLE, ATT_TABLE, attachPartitionTable(), PartitionCmd::bound, BTEqualStrategyNumber, CacheInvalidateRelcacheByRelid(), check_new_partition_bound(), context, CStringGetDatum(), ereport, errcode(), errdetail(), errmsg(), ERROR, eval_const_expressions(), find_all_inheritors(), FindTriggerIncompatibleWithInheritance(), get_default_oid_from_partdesc(), get_proposed_default_constraint(), get_qual_from_partbound(), HeapTupleIsValid, PartitionBoundSpec::is_default, lfirst_oid, list_concat(), list_make1, list_member_oid(), LockRelationOid(), make_ands_explicit(), make_parsestate(), map_partition_varattnos(), PartitionCmd::name, NameStr, TupleDescData::natts, NoLock, ObjectAddressSet, ObjectIdGetDatum(), OidIsValid, ParseState::p_sourcetext, QueuePartitionConstraintValidation(), RelationData::rd_islocaltemp, RelationData::rd_rel, RelationGetDescr, RelationGetPartitionDesc(), RelationGetPartitionQual(), RelationGetRelationName, RelationGetRelid, ScanKeyInit(), SearchSysCacheExists2, systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), table_openrv(), RelationData::trigdesc, and TupleDescAttr.
Referenced by ATExecCmd().
|
static |
Definition at line 20478 of file tablecmds.c.
References AccessExclusiveLock, AccessShareLock, build_attrmap_by_name(), BuildIndexInfo(), CompareIndexInfo(), ConstraintSetParentConstraint(), ereport, errcode(), errdetail(), errmsg(), ERROR, free_attrmap(), get_partition_parent(), get_relation_idx_constraint_oid(), i, IndexSetParentIndex(), InvalidOid, name, NoLock, PartitionDescData::nparts, ObjectAddressSet, OidIsValid, PartitionDescData::oids, RangeVarCallbackForAttachIndex(), RangeVarGetRelidExtended(), RelationData::rd_indcollation, RelationData::rd_index, RelationData::rd_opfamily, RelationData::rd_rel, refuseDupeIndexAttach(), relation_close(), relation_open(), RelationGetDescr, RelationGetPartitionDesc(), RelationGetRelationName, RelationGetRelid, validatePartitionedIndex(), and verifyPartitionIndexNotNull().
Referenced by ATExecCmd().
Definition at line 15008 of file tablecmds.c.
References ACL_CREATE, aclcheck_error(), ACLCHECK_NOT_OWNER, ACLCHECK_OK, aclnewowner(), AlterTypeOwnerInternal(), CatalogTupleUpdate(), change_owner_fix_column_acls(), change_owner_recurse_to_sequences(), changeDependencyOnOwner(), check_can_set_role(), DatumGetAclP, DEPENDENCY_AUTO, DEPENDENCY_INTERNAL, elog, ereport, errcode(), errdetail(), errdetail_relkind_not_supported(), errhint(), errmsg(), ERROR, get_namespace_name(), get_rel_name(), get_rel_relkind(), get_relkind_objtype(), GETSTRUCT, GetUserId(), heap_freetuple(), heap_modify_tuple(), HeapTupleIsValid, i, InvalidOid, InvokeObjectPostAlterHook, lfirst_oid, list_free(), NameStr, NoLock, object_aclcheck(), object_ownercheck(), OBJECT_SCHEMA, ObjectIdGetDatum(), OidIsValid, PointerGetDatum(), relation_close(), relation_open(), RelationGetDescr, RelationGetIndexList(), RelationGetRelationName, ReleaseSysCache(), RowExclusiveLock, SearchSysCache1(), sequenceIsOwned(), superuser(), SysCacheGetAttr(), HeapTupleData::t_self, table_close(), table_open(), and WARNING.
Referenced by AlterTypeOwner_oid(), ATExecCmd(), change_owner_recurse_to_sequences(), and shdepReassignOwned().
|
static |
Definition at line 15383 of file tablecmds.c.
References check_index_is_clusterable(), ereport, errcode(), errmsg(), ERROR, get_relname_relid(), mark_index_clustered(), ObjectAddressSet, OidIsValid, RelationData::rd_rel, and RelationGetRelationName.
Referenced by ATExecCmd().
|
static |
Definition at line 5279 of file tablecmds.c.
References AlterDomainAddConstraint(), Assert, AT_AddColumn, AT_AddColumnToView, AT_AddConstraint, AT_AddIdentity, AT_AddIndex, AT_AddIndexConstraint, AT_AddInherit, AT_AddOf, AT_AlterColumnGenericOptions, AT_AlterColumnType, AT_AlterConstraint, AT_AttachPartition, AT_ChangeOwner, AT_ClusterOn, AT_ColumnDefault, AT_CookedColumnDefault, AT_DetachPartition, AT_DetachPartitionFinalize, AT_DisableRowSecurity, AT_DisableRule, AT_DisableTrig, AT_DisableTrigAll, AT_DisableTrigUser, AT_DropCluster, AT_DropColumn, AT_DropConstraint, AT_DropExpression, AT_DropIdentity, AT_DropInherit, AT_DropNotNull, AT_DropOf, AT_DropOids, AT_EnableAlwaysRule, AT_EnableAlwaysTrig, AT_EnableReplicaRule, AT_EnableReplicaTrig, AT_EnableRowSecurity, AT_EnableRule, AT_EnableTrig, AT_EnableTrigAll, AT_EnableTrigUser, AT_ForceRowSecurity, AT_GenericOptions, AT_MergePartitions, AT_NoForceRowSecurity, AT_PASS_ADD_CONSTR, AT_ReAddComment, AT_ReAddConstraint, AT_ReAddDomainConstraint, AT_ReAddIndex, AT_ReAddStatistics, AT_ReplaceRelOptions, AT_ReplicaIdentity, AT_ResetOptions, AT_ResetRelOptions, AT_SetAccessMethod, AT_SetAttNotNull, AT_SetCompression, AT_SetExpression, AT_SetIdentity, AT_SetLogged, AT_SetNotNull, AT_SetOptions, AT_SetRelOptions, AT_SetStatistics, AT_SetStorage, AT_SetTableSpace, AT_SetUnLogged, AT_SplitPartition, AT_ValidateConstraint, ATExecAddColumn(), ATExecAddConstraint(), ATExecAddIdentity(), ATExecAddIndex(), ATExecAddIndexConstraint(), ATExecAddInherit(), ATExecAddOf(), ATExecAddStatistics(), ATExecAlterColumnGenericOptions(), ATExecAlterColumnType(), ATExecAlterConstraint(), ATExecAttachPartition(), ATExecAttachPartitionIdx(), ATExecChangeOwner(), ATExecClusterOn(), ATExecColumnDefault(), ATExecCookedColumnDefault(), ATExecDetachPartition(), ATExecDetachPartitionFinalize(), ATExecDropCluster(), ATExecDropColumn(), ATExecDropConstraint(), ATExecDropExpression(), ATExecDropIdentity(), ATExecDropInherit(), ATExecDropNotNull(), ATExecDropOf(), ATExecEnableDisableRule(), ATExecEnableDisableTrigger(), ATExecForceNoForceRowSecurity(), ATExecGenericOptions(), ATExecMergePartitions(), ATExecReplicaIdentity(), ATExecSetAccessMethodNoStorage(), ATExecSetAttNotNull(), ATExecSetCompression(), ATExecSetExpression(), ATExecSetIdentity(), ATExecSetNotNull(), ATExecSetOptions(), ATExecSetRelOptions(), ATExecSetRowSecurity(), ATExecSetStatistics(), ATExecSetStorage(), ATExecSetTableSpaceNoStorage(), ATExecSplitPartition(), ATExecValidateConstraint(), ATParseTransformCmd(), AlterTableCmd::behavior, AlteredTableInfo::chgAccessMethod, CommandCounterIncrement(), CommentObject(), context, AlterTableCmd::def, elog, ERROR, EventTriggerCollectAlterTableSubcmd(), get_rolespec_oid(), InvalidObjectAddress, AlterTableCmd::missing_ok, AlterTableCmd::name, AlteredTableInfo::newAccessMethod, AlterTableCmd::newowner, AlteredTableInfo::newTableSpace, AlterTableCmd::num, RelationData::rd_rel, AlterTableCmd::recurse, AlteredTableInfo::rel, RelationGetRelid, RULE_DISABLED, RULE_FIRES_ALWAYS, RULE_FIRES_ON_ORIGIN, RULE_FIRES_ON_REPLICA, AlterTableCmd::subtype, TRIGGER_DISABLED, TRIGGER_FIRES_ALWAYS, TRIGGER_FIRES_ON_ORIGIN, and TRIGGER_FIRES_ON_REPLICA.
Referenced by ATRewriteCatalogs().
|
static |
Definition at line 8087 of file tablecmds.c.
References AddRelationNewConstraints(), RawColumnDefault::attnum, attnum, DROP_RESTRICT, ereport, errcode(), errhint(), errmsg(), ERROR, RawColumnDefault::generated, get_attnum(), InvalidAttrNumber, list_make1, RawColumnDefault::missingMode, NIL, ObjectAddressSubSet, palloc(), RawColumnDefault::raw_default, RelationGetDescr, RelationGetRelationName, RelationGetRelid, RemoveAttrDefault(), and TupleDescAttr.
Referenced by ATExecCmd().
|
static |
Definition at line 8173 of file tablecmds.c.
References attnum, DROP_RESTRICT, ObjectAddressSubSet, RelationGetRelid, RemoveAttrDefault(), and StoreAttrDefault().
Referenced by ATExecCmd().
|
static |
Definition at line 19865 of file tablecmds.c.
References AccessExclusiveLock, ATDetachCheckNoForeignKeyRefs(), CacheInvalidateRelcache(), CommitTransactionCommand(), DetachAddConstraintIfNeeded(), DetachPartitionFinalize(), elog, ereport, errcode(), errmsg(), ERROR, get_default_oid_from_partdesc(), list_make1, LockRelationOid(), MarkInheritDetached(), MemoryContextStrdup(), MyDatabaseId, name, NoLock, ObjectAddressSet, OidIsValid, PopActiveSnapshot(), PortalContext, AlteredTableInfo::rel, RelationGetPartitionDesc(), RelationGetRelationName, RelationGetRelid, RemoveInheritance(), SET_LOCKTAG_RELATION, ShareUpdateExclusiveLock, StartTransactionCommand(), table_close(), table_openrv(), try_relation_open(), WaitForLockersMultiple(), and WARNING.
Referenced by ATExecCmd().
|
static |
Definition at line 20275 of file tablecmds.c.
References AccessExclusiveLock, DetachPartitionFinalize(), GetActiveSnapshot(), InvalidOid, name, NoLock, ObjectAddressSet, RelationGetRelid, table_close(), table_openrv(), WaitForOlderSnapshots(), and SnapshotData::xmin.
Referenced by ATExecCmd().
Definition at line 15415 of file tablecmds.c.
References InvalidOid, and mark_index_clustered().
Referenced by ATExecCmd().
|
static |
Definition at line 9157 of file tablecmds.c.
References add_exact_object_address(), Assert, AT_DropColumn, ATSimplePermissions(), ATT_FOREIGN_TABLE, ATT_TABLE, attnum, bms_make_singleton(), CatalogTupleUpdate(), check_stack_depth(), CheckTableNotInUse(), CommandCounterIncrement(), elog, ereport, errcode(), errhint(), errmsg(), ERROR, find_inheritance_children(), FirstLowInvalidHeapAttributeNumber, free_object_addresses(), GETSTRUCT, has_partition_attrs(), heap_freetuple(), HeapTupleIsValid, InvalidObjectAddress, lfirst_oid, new_object_addresses(), NoLock, NOTICE, performMultipleDeletions(), RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), RowExclusiveLock, SearchSysCacheAttName(), SearchSysCacheCopyAttName(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecCmd().
|
static |
Definition at line 12874 of file tablecmds.c.
References BTEqualStrategyNumber, CStringGetDatum(), dropconstraint_internal(), ereport, errcode(), errmsg(), ERROR, HeapTupleIsValid, InvalidOid, NIL, NOTICE, ObjectIdGetDatum(), RelationGetRelationName, RelationGetRelid, RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by ATExecCmd().
|
static |
Definition at line 8698 of file tablecmds.c.
References attnum, CatalogTupleUpdate(), CommandCounterIncrement(), deleteDependencyRecordsFor(), DROP_RESTRICT, elog, ereport, errcode(), errmsg(), ERROR, GetAttrDefaultOid(), GETSTRUCT, heap_freetuple(), HeapTupleIsValid, InvalidObjectAddress, InvokeObjectPostAlterHook, NOTICE, ObjectAddressSubSet, OidIsValid, RelationGetRelationName, RelationGetRelid, RemoveAttrDefault(), RowExclusiveLock, SearchSysCacheCopyAttName(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecCmd().
|
static |
Definition at line 8425 of file tablecmds.c.
References attnum, CatalogTupleUpdate(), ObjectAddress::classId, CommandCounterIncrement(), deleteDependencyRecordsForClass(), DEPENDENCY_INTERNAL, DROP_RESTRICT, ereport, errcode(), errhint(), errmsg(), ERROR, find_inheritance_children(), getIdentitySequence(), GETSTRUCT, heap_freetuple(), HeapTupleIsValid, InvalidObjectAddress, InvokeObjectPostAlterHook, lfirst_oid, NoLock, NOTICE, ObjectAddressSubSet, ObjectAddress::objectId, ObjectAddress::objectSubId, PERFORM_DELETION_INTERNAL, performDeletion(), RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, SearchSysCacheCopyAttName(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecCmd(), and DetachPartitionFinalize().
|
static |
Definition at line 16750 of file tablecmds.c.
References AccessShareLock, ATInheritAdjustNotNulls(), ereport, errcode(), errmsg(), ERROR, NoLock, ObjectAddressSet, RelationData::rd_rel, RelationGetRelid, RemoveInheritance(), table_close(), and table_openrv().
Referenced by ATExecCmd().
|
static |
Definition at line 7571 of file tablecmds.c.
References AccessShareLock, attnotnull, attnum, bms_is_member(), CatalogTupleUpdate(), DROP_RESTRICT, dropconstraint_internal(), ereport, errcode(), errhint(), errmsg(), ERROR, find_inheritance_children(), findNotNullConstraint(), FirstLowInvalidHeapAttributeNumber, get_attname(), get_attnum(), get_partition_parent(), GETSTRUCT, heap_freetuple(), HeapTupleIsValid, INDEX_ATTR_BITMAP_IDENTITY_KEY, INDEX_ATTR_BITMAP_PRIMARY_KEY, InvalidObjectAddress, InvokeObjectPostAlterHook, NIL, NoLock, PartitionDescData::nparts, ObjectAddressSubSet, RelationData::rd_rel, RelationGetDescr, RelationGetIndexAttrBitmap(), RelationGetPartitionDesc(), RelationGetRelationName, RelationGetRelid, RowExclusiveLock, SearchSysCacheCopyAttName(), HeapTupleData::t_self, table_close(), table_open(), and TupleDescAttr.
Referenced by ATExecCmd().
Definition at line 17323 of file tablecmds.c.
References CatalogTupleUpdate(), DEPENDENCY_NORMAL, drop_parent_dependency(), elog, ereport, errcode(), errmsg(), ERROR, GETSTRUCT, heap_freetuple(), HeapTupleIsValid, InvalidOid, InvokeObjectPostAlterHook, ObjectIdGetDatum(), OidIsValid, RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, SearchSysCacheCopy1, HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecCmd().
|
static |
Definition at line 16153 of file tablecmds.c.
References EnableDisableRule(), InvokeObjectPostAlterHook, and RelationGetRelid.
Referenced by ATExecCmd().
|
static |
Definition at line 16135 of file tablecmds.c.
References EnableDisableTrigger(), InvalidOid, InvokeObjectPostAlterHook, and RelationGetRelid.
Referenced by ATExecCmd().
Definition at line 17593 of file tablecmds.c.
References CatalogTupleUpdate(), elog, ERROR, GETSTRUCT, heap_freetuple(), HeapTupleIsValid, InvokeObjectPostAlterHook, ObjectIdGetDatum(), RelationGetRelid, RowExclusiveLock, SearchSysCacheCopy1, HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecCmd().
Definition at line 17622 of file tablecmds.c.
References CacheInvalidateRelcache(), CatalogTupleUpdate(), DatumGetPointer(), ereport, errcode(), errmsg(), ERROR, ForeignServer::fdwid, ForeignDataWrapper::fdwvalidator, GetForeignDataWrapper(), GetForeignServer(), GETSTRUCT, heap_freetuple(), heap_modify_tuple(), HeapTupleIsValid, InvokeObjectPostAlterHook, NIL, ObjectIdGetDatum(), PointerGetDatum(), PointerIsValid, RelationData::rd_id, RelationGetDescr, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, SearchSysCacheCopy1, SysCacheGetAttr(), HeapTupleData::t_self, table_close(), table_open(), and transformGenericOptions().
Referenced by ATExecCmd().
|
static |
Definition at line 21499 of file tablecmds.c.
References AccessExclusiveLock, attachPartitionTable(), PartitionCmd::bound, CommandCounterIncrement(), context, createPartitionTable(), DetachPartitionFinalize(), DROP_RESTRICT, equal(), get_default_oid_from_partdesc(), get_namespace_name(), lappend(), lfirst, list_free(), makeRangeVar(), moveMergedTablesRows(), MyProcPid, name, PartitionCmd::name, NAMEDATALEN, NIL, NoLock, PartitionCmd::partlist, performDeletion(), RelationGetNamespace, RelationGetPartitionDesc(), RelationGetRelationName, RelationGetRelid, RangeVar::relname, RemoveInheritance(), RenameRelationInternal(), sprintf, table_close(), and table_openrv().
Referenced by ATExecCmd().
|
static |
Definition at line 17455 of file tablecmds.c.
References IndexAmRoutine::amcanunique, elog, ereport, errcode(), errmsg(), ERROR, get_relname_relid(), index_close(), index_open(), IndexRelationGetNumberOfKeyAttributes, InvalidOid, sort-test::key, NameStr, NIL, NoLock, OidIsValid, RelationData::rd_att, RelationData::rd_indam, RelationData::rd_index, RelationData::rd_rel, relation_mark_replica_identity(), RelationGetIndexExpressions(), RelationGetIndexPredicate(), RelationGetRelationName, RelationGetRelid, ShareLock, stmt, and TupleDescAttr.
Referenced by ATExecCmd().
Definition at line 15461 of file tablecmds.c.
References Assert, CatalogTupleUpdate(), changeDependencyFor(), CommandCounterIncrement(), deleteDependencyRecordsForClass(), DEPENDENCY_NORMAL, elog, ERROR, GETSTRUCT, heap_freetuple(), HeapTupleIsValid, InvokeObjectPostAlterHook, ObjectAddressSet, ObjectIdGetDatum(), OidIsValid, RelationData::rd_rel, recordDependencyOn(), RelationGetRelid, RowExclusiveLock, SearchSysCacheCopy1, HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecCmd().
|
static |
Definition at line 8021 of file tablecmds.c.
References attnum, ereport, errcode(), errmsg(), ERROR, get_attnum(), InvalidAttrNumber, InvalidObjectAddress, ObjectAddressSubSet, RelationGetRelationName, RelationGetRelid, and set_attnotnull().
Referenced by ATExecCmd().
|
static |
Definition at line 17703 of file tablecmds.c.
References attnum, CatalogTupleUpdate(), CommandCounterIncrement(), ereport, errcode(), errmsg(), ERROR, GetAttributeCompression(), GETSTRUCT, heap_freetuple(), HeapTupleIsValid, InvokeObjectPostAlterHook, ObjectAddressSubSet, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, SearchSysCacheCopyAttName(), SetIndexStorageProperties(), strVal, HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecCmd().
|
static |
Definition at line 8539 of file tablecmds.c.
References AddRelationNewConstraints(), AT_REWRITE_DEFAULT_VAL, AT_SetExpression, RawColumnDefault::attnum, attnum, build_column_default(), CommandCounterIncrement(), deleteDependencyRecordsFor(), DROP_RESTRICT, elog, ereport, errcode(), errmsg(), ERROR, expression_planner(), RawColumnDefault::generated, GetAttrDefaultOid(), GETSTRUCT, HeapTupleIsValid, InvokeObjectPostAlterHook, lappend(), list_make1, RawColumnDefault::missingMode, newval, AlteredTableInfo::newvals, NIL, ObjectAddressSubSet, OidIsValid, palloc(), palloc0(), RawColumnDefault::raw_default, RelationClearMissing(), RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), RememberAllDependentForRebuilding(), RemoveAttrDefault(), RemoveStatistics(), AlteredTableInfo::rewrite, and SearchSysCacheAttName().
Referenced by ATExecCmd().
|
static |
Definition at line 8308 of file tablecmds.c.
References attnum, castNode, CatalogTupleUpdate(), defGetInt32(), DefElem::defname, elog, ereport, errcode(), errhint(), errmsg(), ERROR, find_inheritance_children(), GETSTRUCT, heap_freetuple(), HeapTupleIsValid, InvalidObjectAddress, InvokeObjectPostAlterHook, lfirst_node, lfirst_oid, NoLock, ObjectAddressSubSet, RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, SearchSysCacheCopyAttName(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecCmd().
|
static |
Definition at line 7817 of file tablecmds.c.
References AddRelationNewConstraints(), Assert, AT_AddConstraint, ATSimplePermissions(), ATT_FOREIGN_TABLE, ATT_TABLE, attnum, BTEqualStrategyNumber, CatalogTupleUpdate(), check_stack_depth(), ChooseConstraintName(), Constraint::conname, CookedConstraint::conoid, CONSTR_NOTNULL, Constraint::contype, Constraint::deferrable, ereport, errcode(), errhint(), errmsg(), ERROR, extractNotNullColumn(), find_inheritance_children(), get_attnum(), GETSTRUCT, heap_copytuple(), HeapTupleIsValid, Constraint::inhcount, Constraint::initdeferred, Constraint::initially_valid, InvalidAttrNumber, InvalidObjectAddress, InvokeObjectPostAlterHook, Constraint::is_no_inherit, Constraint::keys, lappend_oid(), lfirst_oid, linitial, list_make1, list_member_oid(), Constraint::location, makeNode, makeString(), NIL, NoLock, ObjectAddressSet, ObjectIdGetDatum(), RelationData::rd_rel, RelationGetNamespace, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, ScanKeyInit(), set_attnotnull(), Constraint::skip_validation, systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecCmd().
|
static |
Definition at line 8924 of file tablecmds.c.
References attnum, attribute_reloptions(), castNode, CatalogTupleUpdate(), ereport, errcode(), errmsg(), ERROR, GETSTRUCT, heap_freetuple(), heap_modify_tuple(), HeapTupleIsValid, InvokeObjectPostAlterHook, ObjectAddressSubSet, RelationGetDescr, RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), RowExclusiveLock, SearchSysCacheAttName(), SysCacheGetAttr(), HeapTupleData::t_self, table_close(), table_open(), and transformRelOptions().
Referenced by ATExecCmd().
|
static |
Definition at line 15581 of file tablecmds.c.
References _, IndexAmRoutine::amoptions, AT_ReplaceRelOptions, AT_ResetRelOptions, CatalogTupleUpdate(), DefElem::defname, elog, ereport, errcode(), errdetail_relkind_not_supported(), errhint(), errmsg(), ERROR, get_view_query(), heap_freetuple(), heap_modify_tuple(), HEAP_RELOPT_NAMESPACES, heap_reloptions(), HeapTupleIsValid, index_reloptions(), InvalidOid, InvokeObjectPostAlterHook, InvokeObjectPostAlterHookArg, lfirst, NIL, NoLock, ObjectIdGetDatum(), OidIsValid, partitioned_table_reloptions(), RelationData::rd_indam, RelationData::rd_rel, RelationGetDescr, RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), RowExclusiveLock, SearchSysCache1(), SysCacheGetAttr(), HeapTupleData::t_self, table_close(), table_open(), transformRelOptions(), untransformRelOptions(), view_query_is_auto_updatable(), and view_reloptions().
Referenced by ATExecCmd().
Definition at line 17563 of file tablecmds.c.
References CatalogTupleUpdate(), elog, ERROR, GETSTRUCT, heap_freetuple(), HeapTupleIsValid, InvokeObjectPostAlterHook, ObjectIdGetDatum(), RelationGetRelid, RowExclusiveLock, SearchSysCacheCopy1, HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecCmd().
|
static |
Definition at line 8789 of file tablecmds.c.
References attnum, CatalogTupleUpdate(), ereport, errcode(), errhint(), errmsg(), ERROR, GETSTRUCT, heap_freetuple(), heap_modify_tuple(), HeapTupleIsValid, intVal, InvokeObjectPostAlterHook, MAX_STATISTICS_TARGET, NameStr, ObjectAddressSubSet, RelationData::rd_index, RelationData::rd_rel, RelationGetDescr, RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), RowExclusiveLock, SearchSysCacheAttName(), SearchSysCacheAttNum(), HeapTupleData::t_self, table_close(), table_open(), and WARNING.
Referenced by ATExecCmd().
|
static |
Definition at line 9066 of file tablecmds.c.
References attnum, CatalogTupleUpdate(), ereport, errcode(), errmsg(), ERROR, GetAttributeStorage(), GETSTRUCT, heap_freetuple(), HeapTupleIsValid, InvokeObjectPostAlterHook, ObjectAddressSubSet, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, SearchSysCacheCopyAttName(), SetIndexStorageProperties(), strVal, HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecCmd().
Definition at line 15784 of file tablecmds.c.
References Assert, CheckRelationTableSpaceMove(), CommandCounterIncrement(), GetNewRelFileNumber(), index_copy_data(), InvokeObjectPostAlterHook, lfirst_oid, list_free(), NIL, NoLock, OidIsValid, RelationData::rd_locator, RelationData::rd_rel, relation_close(), relation_open(), RelationAssumeNewRelfilelocator(), RelationGetIndexList(), RelationGetRelid, RelFileLocator::relNumber, SetRelationTableSpace(), RelFileLocator::spcOid, and table_relation_copy_data().
Referenced by ATRewriteTables().
Definition at line 15877 of file tablecmds.c.
References Assert, CheckRelationTableSpaceMove(), CommandCounterIncrement(), InvalidOid, InvokeObjectPostAlterHook, RelationData::rd_rel, RelationGetRelid, and SetRelationTableSpace().
Referenced by ATExecCmd().
|
static |
Definition at line 21268 of file tablecmds.c.
References AccessExclusiveLock, attachPartitionTable(), SinglePartitionSpec::bound, CommandCounterIncrement(), context, createPartitionTable(), DetachPartitionFinalize(), DROP_RESTRICT, ereport, errcode(), errmsg(), ERROR, forboth, get_default_oid_from_partdesc(), get_namespace_name(), get_relname_relid(), InvalidOid, lappend(), lfirst, makeRangeVar(), moveSplitTableRows(), MyProcPid, SinglePartitionSpec::name, PartitionCmd::name, NAMEDATALEN, NIL, NoLock, PartitionCmd::partlist, performDeletion(), RangeVarGetAndCheckCreationNamespace(), RelationGetNamespace, RelationGetPartitionDesc(), RelationGetRelationName, RelationGetRelid, relname, RangeVar::relname, RemoveInheritance(), RenameRelationInternal(), sprintf, strlcpy(), table_close(), and table_openrv().
Referenced by ATExecCmd().
|
static |
Definition at line 12001 of file tablecmds.c.
References ATGetQueueEntry(), BTEqualStrategyNumber, CacheInvalidateRelcache(), CatalogTupleUpdate(), NewConstraint::conid, Constraint::conname, CONSTR_CHECK, CONSTR_FOREIGN, AlteredTableInfo::constraints, NewConstraint::contype, CStringGetDatum(), ereport, errcode(), errmsg(), ERROR, find_all_inheritors(), GETSTRUCT, heap_copytuple(), heap_freetuple(), HeapTupleIsValid, InvalidObjectAddress, InvalidOid, InvokeObjectPostAlterHook, lappend(), lfirst_oid, makeNode, NewConstraint::name, NIL, NoLock, ObjectAddressSet, ObjectIdGetDatum(), palloc0(), NewConstraint::qual, NewConstraint::refindid, NewConstraint::refrelid, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, ScanKeyInit(), stringToNode(), SysCacheGetAttrNotNull(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), table_open(), TextDatumGetCString, and val.
Referenced by ATExecCmd().
|
static |
Definition at line 6430 of file tablecmds.c.
References AlteredTableInfo::chgAccessMethod, AlteredTableInfo::chgPersistence, CreateTupleDescCopyConstr(), InvalidOid, lappend(), lfirst, AlteredTableInfo::newAccessMethod, AlteredTableInfo::newrelpersistence, AlteredTableInfo::newTableSpace, AlteredTableInfo::oldDesc, palloc0(), RelationData::rd_rel, AlteredTableInfo::rel, RelationGetDescr, RelationGetRelid, AlteredTableInfo::relid, and AlteredTableInfo::relkind.
Referenced by addFkRecurseReferencing(), ATAddCheckNNConstraint(), ATExecAddColumn(), ATExecValidateConstraint(), ATPostAlterTypeParse(), ATPrepCmd(), DetachAddConstraintIfNeeded(), QueuePartitionConstraintValidation(), and set_attnotnull().
|
static |
Definition at line 17084 of file tablecmds.c.
References AdjustNotNullInheritance(), AttrMap::attnums, bms_add_member(), bms_next_member(), build_attrmap_by_name(), CommandCounterIncrement(), FirstLowInvalidHeapAttributeNumber, i, INDEX_ATTR_BITMAP_PRIMARY_KEY, RelationData::rd_rel, RelationGetDescr, RelationGetIndexAttrBitmap(), and RelationGetRelid.
Referenced by ATExecAddInherit(), and ATExecDropInherit().
|
static |
Definition at line 5631 of file tablecmds.c.
References AlteredTableInfo::afterStmts, AT_AddConstraint, AT_AddIndex, AT_AddIndexConstraint, AT_AlterColumnGenericOptions, AT_PASS_ADD_INDEX, AT_PASS_ADD_INDEXCONSTR, AT_PASS_ADD_OTHERCONSTR, AT_PASS_COL_ATTRS, AT_PASS_MISC, AT_SetAttNotNull, ATPrepAddPrimaryKey(), ATSimpleRecursion(), castNode, AlterTableStmt::cmds, CommandCounterIncrement(), CONSTR_EXCLUSION, CONSTR_PRIMARY, CONSTR_UNIQUE, context, AlterTableCmd::def, elog, ERROR, get_namespace_name(), RangeVar::inh, lappend(), lfirst, lfirst_node, list_concat(), list_make1, makeNode, makeRangeVar(), AlterTableStmt::missing_ok, OBJECT_TABLE, AlterTableStmt::objtype, ProcessUtilityForAlterTable(), pstrdup(), AlterTableCmd::recurse, AlterTableStmt::relation, RelationGetNamespace, RelationGetRelationName, RelationGetRelid, stmt, AlteredTableInfo::subcmds, AlterTableCmd::subtype, and transformAlterTableStmt().
Referenced by ATExecAddColumn(), ATExecCmd(), and ATPrepCmd().
|
static |
Definition at line 14389 of file tablecmds.c.
References AccessExclusiveLock, add_exact_object_address(), ATPostAlterTypeParse(), AlteredTableInfo::changedConstraintDefs, AlteredTableInfo::changedConstraintOids, elog, ERROR, forboth, get_typ_typrelid(), getBaseType(), GETSTRUCT, HeapTupleIsValid, lfirst, lfirst_oid, LockRelationOid(), new_object_addresses(), ObjectAddressSet, ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), AlteredTableInfo::relid, AlteredTableInfo::rewrite, and SearchSysCache1().
Referenced by ATRewriteCatalogs().
|
static |
Definition at line 14558 of file tablecmds.c.
References AT_AddConstraint, AT_AddIndex, AT_PASS_MISC, AT_PASS_OLD_COL_ATTRS, AT_PASS_OLD_CONSTR, AT_PASS_OLD_INDEX, AT_ReAddConstraint, AT_ReAddDomainConstraint, AT_ReAddIndex, AT_ReAddStatistics, AT_SetAttNotNull, ATGetQueueEntry(), castNode, Constraint::conname, CONSTR_FOREIGN, Constraint::contype, AlterTableCmd::def, elog, ERROR, get_constraint_index(), GetComment(), IndexStmt::idxcomment, IndexStmt::idxname, IsA, lappend(), lfirst, lfirst_node, list_concat(), makeNode, NIL, nodeTag, NoLock, Constraint::old_pktable_oid, RAW_PARSE_DEFAULT, raw_parser(), RebuildConstraintComment(), relation_close(), relation_open(), Constraint::reset_default_tblspc, IndexStmt::reset_default_tblspc, AlteredTableInfo::rewrite, RawStmt::stmt, stmt, AlteredTableInfo::subcmds, AlterTableCmd::subtype, transformAlterTableStmt(), transformIndexStmt(), transformStatsStmt(), TryReuseForeignKey(), and TryReuseIndex().
Referenced by ATPostAlterTypeCleanup().
|
static |
Definition at line 7058 of file tablecmds.c.
References ATTypedTableRecursion(), context, ereport, errcode(), errmsg(), ERROR, RelationData::rd_rel, and AlterTableCmd::recurse.
Referenced by ATPrepCmd().
|
static |
Definition at line 16170 of file tablecmds.c.
References ereport, errcode(), errmsg(), ERROR, and RelationData::rd_rel.
Referenced by ATPrepCmd().
|
static |
Definition at line 9353 of file tablecmds.c.
References Assert, AT_AddConstraint, ATPrepCmd(), castNode, Constraint::conname, CONSTR_NOTNULL, context, Constraint::contype, AlterTableCmd::def, Constraint::deferrable, find_all_inheritors(), find_inheritance_children(), foreach_node, foreach_oid, IndexStmt::indexParams, Constraint::inhcount, Constraint::initdeferred, Constraint::initially_valid, IsA, Constraint::keys, lappend(), lfirst, list_make1, Constraint::location, makeNode, makeString(), NIL, NoLock, IndexStmt::primary, RelationData::rd_rel, AlterTableCmd::recurse, RelationGetRelid, Constraint::skip_validation, AlterTableCmd::subtype, table_close(), and table_open().
Referenced by ATParseTransformCmd().
|
static |
Definition at line 13382 of file tablecmds.c.
References ACL_USAGE, aclcheck_error_type(), ACLCHECK_OK, assign_expr_collations(), AT_REWRITE_COLUMN_REWRITE, ATColumnChangeRequiresRewrite(), ATPrepCmd(), attnum, ATTypedTableRecursion(), bms_make_singleton(), build_attrmap_by_name(), CheckAttributeType(), CheckTableNotInUse(), COERCE_IMPLICIT_CAST, coerce_to_target_type(), COERCION_ASSIGNMENT, context, ColumnDef::cooked_default, copyObject, AlterTableCmd::def, ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, expression_planner(), exprType(), find_all_inheritors(), find_composite_type_dependencies(), find_inheritance_children(), FirstLowInvalidHeapAttributeNumber, forboth, format_type_be(), format_type_with_typemod(), GetColumnDefCollation(), GETSTRUCT, GetUserId(), has_partition_attrs(), HeapTupleIsValid, InvalidOid, lappend(), lfirst_int, lfirst_oid, list_make1_oid, make_parsestate(), makeVar(), map_variable_attnos(), AlterTableCmd::name, newval, AlteredTableInfo::newvals, NIL, NoLock, object_aclcheck(), palloc0(), pfree(), quote_identifier(), RelationData::rd_rel, relation_close(), relation_open(), RelationGetDescr, RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), AlteredTableInfo::relkind, AlteredTableInfo::rewrite, SearchSysCacheAttName(), ColumnDef::typeName, and typenameTypeIdAndMod().
Referenced by ATPrepCmd().
Definition at line 17783 of file tablecmds.c.
References AccessShareLock, BTEqualStrategyNumber, ereport, errcode(), errdetail(), errmsg(), ERROR, errtable(), errtableconstraint(), GetRelationPublications(), GETSTRUCT, HeapTupleIsValid, InvalidOid, NameStr, NIL, ObjectIdGetDatum(), RelationData::rd_rel, relation_close(), relation_open(), RelationGetRelationName, RelationGetRelid, RelationIsPermanent, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by ATPrepCmd().
|
static |
Definition at line 4814 of file tablecmds.c.
References Assert, AT_AddColumn, AT_AddColumnToView, AT_AddConstraint, AT_AddIdentity, AT_AddIndex, AT_AddIndexConstraint, AT_AddInherit, AT_AddOf, AT_AlterColumnGenericOptions, AT_AlterColumnType, AT_AlterConstraint, AT_AttachPartition, AT_ChangeOwner, AT_ClusterOn, AT_ColumnDefault, AT_CookedColumnDefault, AT_DetachPartition, AT_DetachPartitionFinalize, AT_DisableRowSecurity, AT_DisableRule, AT_DisableTrig, AT_DisableTrigAll, AT_DisableTrigUser, AT_DropCluster, AT_DropColumn, AT_DropConstraint, AT_DropExpression, AT_DropIdentity, AT_DropInherit, AT_DropNotNull, AT_DropOf, AT_DropOids, AT_EnableAlwaysRule, AT_EnableAlwaysTrig, AT_EnableReplicaRule, AT_EnableReplicaTrig, AT_EnableRowSecurity, AT_EnableRule, AT_EnableTrig, AT_EnableTrigAll, AT_EnableTrigUser, AT_ForceRowSecurity, AT_GenericOptions, AT_MergePartitions, AT_NoForceRowSecurity, AT_PASS_ADD_COL, AT_PASS_ADD_CONSTR, AT_PASS_ADD_INDEX, AT_PASS_ADD_INDEXCONSTR, AT_PASS_ADD_OTHERCONSTR, AT_PASS_ALTER_TYPE, AT_PASS_COL_ATTRS, AT_PASS_DROP, AT_PASS_MISC, AT_PASS_SET_EXPRESSION, AT_PASS_UNSET, AT_ReplaceRelOptions, AT_ReplicaIdentity, AT_ResetOptions, AT_ResetRelOptions, AT_REWRITE_ALTER_PERSISTENCE, AT_SetAccessMethod, AT_SetAttNotNull, AT_SetCompression, AT_SetExpression, AT_SetIdentity, AT_SetLogged, AT_SetNotNull, AT_SetOptions, AT_SetRelOptions, AT_SetStatistics, AT_SetStorage, AT_SetTableSpace, AT_SetUnLogged, AT_SplitPartition, AT_ValidateConstraint, ATCheckPartitionsNotInUse(), ATGetQueueEntry(), ATParseTransformCmd(), ATPrepAddColumn(), ATPrepAddInherit(), ATPrepAlterColumnType(), ATPrepChangePersistence(), ATPrepDropColumn(), ATPrepDropExpression(), ATPrepSetAccessMethod(), ATPrepSetTableSpace(), ATSimplePermissions(), ATSimpleRecursion(), ATT_COMPOSITE_TYPE, ATT_FOREIGN_TABLE, ATT_INDEX, ATT_MATVIEW, ATT_PARTITIONED_INDEX, ATT_SEQUENCE, ATT_TABLE, ATT_VIEW, AlteredTableInfo::chgAccessMethod, AlteredTableInfo::chgPersistence, context, copyObject, AlterTableCmd::def, elog, ereport, errcode(), errhint(), errmsg(), ERROR, lappend(), AlterTableCmd::name, AlteredTableInfo::newrelpersistence, PartitionHasPendingDetach(), RelationData::rd_rel, AlterTableCmd::recurse, RelationGetRelationName, RelationGetRelid, AlteredTableInfo::rewrite, AlteredTableInfo::subcmds, and AlterTableCmd::subtype.
Referenced by ATController(), ATPrepAddPrimaryKey(), ATPrepAlterColumnType(), ATSimpleRecursion(), and ATTypedTableRecursion().
|
static |
Definition at line 9129 of file tablecmds.c.
References ATTypedTableRecursion(), context, ereport, errcode(), errmsg(), ERROR, RelationData::rd_rel, and AlterTableCmd::recurse.
Referenced by ATPrepCmd().
|
static |
Definition at line 8652 of file tablecmds.c.
References ereport, errcode(), errmsg(), ERROR, find_inheritance_children(), GETSTRUCT, HeapTupleIsValid, AlterTableCmd::name, RelationGetRelationName, RelationGetRelid, and SearchSysCacheCopyAttName().
Referenced by ATPrepCmd().
|
static |
Definition at line 15427 of file tablecmds.c.
References AT_REWRITE_ACCESS_METHOD, AlteredTableInfo::chgAccessMethod, default_table_access_method, get_table_am_oid(), InvalidOid, AlteredTableInfo::newAccessMethod, RelationData::rd_rel, and AlteredTableInfo::rewrite.
Referenced by ATPrepCmd().
|
static |
Definition at line 15551 of file tablecmds.c.
References ACL_CREATE, aclcheck_error(), ACLCHECK_OK, ereport, errcode(), errmsg(), ERROR, get_tablespace_oid(), GetUserId(), MyDatabaseTableSpace, AlteredTableInfo::newTableSpace, object_aclcheck(), OBJECT_TABLESPACE, and OidIsValid.
Referenced by ATPrepCmd().
|
static |
Definition at line 5205 of file tablecmds.c.
References AlterTableCreateToastTable(), AT_NUM_PASSES, AT_PASS_ALTER_TYPE, AT_PASS_SET_EXPRESSION, ATExecCmd(), ATPostAlterTypeCleanup(), context, lfirst, lfirst_node, NIL, NoLock, AlteredTableInfo::partition_constraint, AlteredTableInfo::rel, relation_close(), relation_open(), AlteredTableInfo::relid, AlteredTableInfo::relkind, and AlteredTableInfo::subcmds.
Referenced by ATController().
|
static |
Definition at line 6053 of file tablecmds.c.
References Assert, NewColumnValue::attnum, CHECK_FOR_INTERRUPTS, CONSTR_CHECK, CONSTR_FOREIGN, CONSTR_NOTNULL, AlteredTableInfo::constraints, NewConstraint::contype, CreateExecutorState(), DEBUG1, ExprContext::ecxt_scantuple, elog, ereport, errcode(), errmsg(), errmsg_internal(), ERROR, errtable(), errtablecol(), errtableconstraint(), ExecCheck(), ExecClearTuple(), ExecDropSingleTupleTableSlot(), ExecEvalExpr(), ExecInitExpr(), ExecPrepareExpr(), ExecStoreAllNullTuple(), ExecStoreVirtualTuple(), NewColumnValue::expr, NewColumnValue::exprstate, ForwardScanDirection, FreeBulkInsertState(), FreeExecutorState(), GetBulkInsertState(), GetCurrentCommandId(), GetLatestSnapshot(), GetPerTupleExprContext, GetPerTupleMemoryContext, i, NewColumnValue::is_generated, lappend_int(), lfirst, lfirst_int, MakeSingleTupleTableSlot(), MemoryContextSwitchTo(), NewConstraint::name, NameStr, TupleDescData::natts, AlteredTableInfo::newvals, NIL, NoLock, OidIsValid, AlteredTableInfo::oldDesc, AlteredTableInfo::partition_constraint, NewConstraint::qual, NewConstraint::qualstate, RegisterSnapshot(), RelationGetDescr, RelationGetRelationName, RelationGetRelid, AlteredTableInfo::relid, ResetExprContext, AlteredTableInfo::rewrite, slot_attisnull(), slot_getallattrs(), table_beginscan(), table_close(), table_endscan(), table_finish_bulk_insert(), TABLE_INSERT_SKIP_FSM, table_open(), table_scan_getnextslot(), table_slot_callbacks(), table_tuple_insert(), TransferPredicateLocksToHeapRelation(), TupleTableSlot::tts_isnull, TupleTableSlot::tts_nvalid, TupleTableSlot::tts_tableOid, TupleTableSlot::tts_values, TupleDescAttr, UnregisterSnapshot(), AlteredTableInfo::validate_default, and AlteredTableInfo::verify_new_notnull.
Referenced by ATRewriteTables().
|
static |
Definition at line 5768 of file tablecmds.c.
References AlteredTableInfo::afterStmts, ATExecSetTableSpace(), ATRewriteTable(), AlteredTableInfo::chgAccessMethod, AlteredTableInfo::chgPersistence, CommandCounterIncrement(), NewConstraint::conid, Constraint::conname, CONSTR_FOREIGN, AlteredTableInfo::constraints, context, NewConstraint::contype, NewConstraint::conwithperiod, ereport, errcode(), errmsg(), ERROR, EventTriggerTableRewrite(), find_composite_type_dependencies(), finish_heap_swap(), getOwnedSequences(), if(), InvalidOid, InvokeObjectPostAlterHook, IsSystemRelation(), lfirst, lfirst_oid, make_new_heap(), AlteredTableInfo::newAccessMethod, AlteredTableInfo::newrelpersistence, AlteredTableInfo::newTableSpace, AlteredTableInfo::newvals, NIL, NoLock, OidIsValid, AlteredTableInfo::partition_constraint, ProcessUtilityForAlterTable(), NewConstraint::qual, RelationData::rd_rel, ReadNextMultiXactId(), RecentXmin, NewConstraint::refindid, NewConstraint::refrelid, RELATION_IS_OTHER_TEMP, RelationGetRelationName, RelationIsUsedAsCatalogTable, AlteredTableInfo::relid, AlteredTableInfo::relkind, AlteredTableInfo::rewrite, RowShareLock, SequenceChangePersistence(), stmt, table_close(), table_open(), validateForeignKeyConstraint(), and AlteredTableInfo::verify_new_notnull.
Referenced by ATController().
|
static |
Definition at line 6613 of file tablecmds.c.
References aclcheck_error(), ACLCHECK_NOT_OWNER, allowSystemTableMods, alter_table_type_to_string(), ATT_COMPOSITE_TYPE, ATT_FOREIGN_TABLE, ATT_INDEX, ATT_MATVIEW, ATT_PARTITIONED_INDEX, ATT_SEQUENCE, ATT_TABLE, ATT_VIEW, elog, ereport, errcode(), errdetail_relkind_not_supported(), errmsg(), ERROR, get_relkind_objtype(), GetUserId(), IsSystemRelation(), object_ownercheck(), RelationData::rd_rel, RelationGetRelationName, and RelationGetRelid.
Referenced by ATAddCheckNNConstraint(), ATExecAddColumn(), ATExecAddInherit(), ATExecAttachPartition(), ATExecDropColumn(), ATExecSetNotNull(), ATPrepCmd(), and dropconstraint_internal().
|
static |
Definition at line 6688 of file tablecmds.c.
References ATPrepCmd(), CheckTableNotInUse(), context, find_all_inheritors(), lfirst_oid, NoLock, RelationData::rd_rel, relation_close(), relation_open(), and RelationGetRelid.
Referenced by ATParseTransformCmd(), and ATPrepCmd().
|
static |
Definition at line 19504 of file tablecmds.c.
References AccessExclusiveLock, AccessShareLock, ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, build_attrmap_by_name(), BuildIndexInfo(), CommandCounterIncrement(), CompareIndexInfo(), ConstraintSetParentConstraint(), CurrentMemoryContext, DefineIndex(), ereport, errcode(), errdetail(), errmsg(), ERROR, foreach_current_index, generateClonedIndexStmt(), get_attname(), get_attnum(), get_constraint_type(), get_relation_idx_constraint_oid(), i, idx(), IndexInfo::ii_IndexAttrNumbers, IndexInfo::ii_NumIndexKeyAttrs, index_close(), index_open(), IndexSetParentIndex(), InvalidOid, j, lfirst_oid, list_length(), MemoryContextDelete(), MemoryContextSwitchTo(), OidIsValid, palloc(), RelationData::rd_indcollation, RelationData::rd_index, RelationData::rd_opfamily, RelationData::rd_rel, RelationGetDescr, RelationGetIndexList(), RelationGetRelationName, RelationGetRelid, set_attnotnull(), and stmt.
Referenced by attachPartitionTable().
|
static |
Definition at line 19176 of file tablecmds.c.
References AttachPartitionEnsureIndexes(), CloneForeignKeyConstraints(), CloneRowTriggersToPartition(), CreateInheritance(), and StorePartitionBound().
Referenced by ATExecAttachPartition(), ATExecMergePartitions(), and ATExecSplitPartition().
|
static |
Definition at line 6763 of file tablecmds.c.
References Assert, ATPrepCmd(), AlterTableCmd::behavior, CheckTableNotInUse(), context, find_typed_table_dependencies(), lfirst_oid, NoLock, RelationData::rd_rel, relation_close(), relation_open(), and RelationGetRelationName.
Referenced by ATPrepAddColumn(), ATPrepAlterColumnType(), and ATPrepDropColumn().
Definition at line 1308 of file tablecmds.c.
References ACL_USAGE, aclcheck_error_type(), ACLCHECK_OK, TypeName::arrayBounds, attname, attnum, TupleConstr::check, ColumnDef::colname, ColumnDef::compression, TupleDescData::constr, CreateTemplateTupleDesc(), TupleConstr::defval, ereport, errcode(), errmsg(), ERROR, ColumnDef::generated, GetAttributeCompression(), GetAttributeStorage(), GetColumnDefCollation(), GetUserId(), TupleConstr::has_generated_stored, TupleConstr::has_not_null, ColumnDef::identity, ColumnDef::inhcount, ColumnDef::is_local, ColumnDef::is_not_null, lfirst, list_length(), TupleConstr::missing, TupleConstr::num_check, TupleConstr::num_defval, object_aclcheck(), palloc0(), PG_INT16_MAX, TypeName::setof, ColumnDef::storage, ColumnDef::storage_name, TupleDescAttr, TupleDescInitEntry(), TupleDescInitEntryCollation(), ColumnDef::typeName, and typenameTypeIdAndMod().
Referenced by ATExecAddColumn(), DefineRelation(), and DefineVirtualRelation().
Definition at line 15249 of file tablecmds.c.
References aclnewowner(), BTEqualStrategyNumber, CatalogTupleUpdate(), DatumGetAclP, GETSTRUCT, heap_freetuple(), heap_getattr(), heap_modify_tuple(), HeapTupleIsValid, sort-test::key, ObjectIdGetDatum(), PointerGetDatum(), RelationGetDescr, RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecChangeOwner().
|
static |
Definition at line 15314 of file tablecmds.c.
References AccessShareLock, ATExecChangeOwner(), BTEqualStrategyNumber, DEPENDENCY_AUTO, DEPENDENCY_INTERNAL, GETSTRUCT, HeapTupleIsValid, sort-test::key, NoLock, ObjectIdGetDatum(), relation_close(), relation_open(), RelationGetForm, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), and table_open().
Referenced by ATExecChangeOwner().
|
static |
Definition at line 7475 of file tablecmds.c.
References attnum, ereport, errcode(), errmsg(), ERROR, GETSTRUCT, HeapTupleIsValid, NOTICE, ObjectIdGetDatum(), PointerGetDatum(), RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), and SearchSysCache2().
Referenced by ATExecAddColumn(), and renameatt_internal().
void check_of_type | ( | HeapTuple | typetuple | ) |
Definition at line 7015 of file tablecmds.c.
References AccessShareLock, Assert, ereport, errcode(), errmsg(), ERROR, format_type_be(), GETSTRUCT, NoLock, OidIsValid, RelationData::rd_rel, relation_close(), and relation_open().
Referenced by ATExecAddOf(), and transformOfType().
Definition at line 12525 of file tablecmds.c.
References ACL_REFERENCES, aclcheck_error(), ACLCHECK_OK, get_relkind_objtype(), GetUserId(), i, pg_attribute_aclcheck(), pg_class_aclcheck(), RelationData::rd_rel, RelationGetRelationName, and RelationGetRelid.
Referenced by ATAddForeignKeyConstraint().
Definition at line 3630 of file tablecmds.c.
References ereport, errcode(), errmsg(), ERROR, MyDatabaseTableSpace, RelationData::rd_rel, RELATION_IS_OTHER_TEMP, RelationGetRelationName, and RelationIsMapped.
Referenced by ATExecSetTableSpace(), ATExecSetTableSpaceNoStorage(), reindex_index(), and SetRelationTableSpace().
void CheckTableNotInUse | ( | Relation | rel, |
const char * | stmt | ||
) |
Definition at line 4347 of file tablecmds.c.
References AfterTriggerPendingOnRel(), ereport, errcode(), errmsg(), ERROR, RelationData::rd_isnailed, RelationData::rd_refcnt, RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, and stmt.
Referenced by addFkRecurseReferencing(), AlterTable(), ATAddCheckNNConstraint(), ATCheckPartitionsNotInUse(), ATExecAddColumn(), ATExecDropColumn(), ATPrepAlterColumnType(), ATSimpleRecursion(), ATTypedTableRecursion(), cluster_rel(), DefineIndex(), DefineVirtualRelation(), dropconstraint_internal(), ExecRefreshMatView(), heap_drop_with_catalog(), index_drop(), MergeAttributes(), reindex_index(), set_attnotnull(), and truncate_check_activity().
|
static |
Definition at line 9687 of file tablecmds.c.
References buf, lfirst, name, NAMEDATALEN, pstrdup(), strlcpy(), and strVal.
Referenced by addFkRecurseReferenced(), addFkRecurseReferencing(), ATExecAddConstraint(), and CloneFkReferencing().
Definition at line 10965 of file tablecmds.c.
References AccessShareLock, addFkRecurseReferenced(), AttrMap::attnums, BTEqualStrategyNumber, build_attrmap_by_name(), CharGetDatum(), Constraint::conname, Constraint::contype, DeconstructFkConstraintRow(), Constraint::deferrable, elog, ERROR, Constraint::fk_attrs, Constraint::fk_del_action, Constraint::fk_del_set_cols, Constraint::fk_matchtype, Constraint::fk_upd_action, GetForeignKeyActionTriggers(), GETSTRUCT, HeapTupleIsValid, i, index_get_partition(), INDEX_MAX_KEYS, Constraint::initdeferred, Constraint::initially_valid, InvalidOid, sort-test::key, lappend(), lappend_oid(), lfirst_oid, list_member_oid(), Constraint::location, makeNode, makeString(), NameStr, NIL, NoLock, ObjectIdGetDatum(), OidIsValid, Constraint::old_conpfeqop, Constraint::old_pktable_oid, Constraint::pk_attrs, Constraint::pktable, RelationGetDescr, RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), RowExclusiveLock, RowShareLock, ScanKeyInit(), SearchSysCache1(), Constraint::skip_validation, systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), and TupleDescAttr.
Referenced by CloneForeignKeyConstraints().
Definition at line 11171 of file tablecmds.c.
References AccessExclusiveLock, addFkRecurseReferencing(), AttrMap::attnums, build_attrmap_by_name(), ChooseConstraintName(), ChooseForeignKeyConstraintNameAddition(), CommandCounterIncrement(), Constraint::conname, ForeignKeyCacheInfo::conoid, CONSTRAINT_RELATION, ConstraintNameIsUsed(), Constraint::contype, copyObject, CreateConstraintEntry(), DeconstructFkConstraintRow(), Constraint::deferrable, DEPENDENCY_PARTITION_PRI, DEPENDENCY_PARTITION_SEC, elog, ereport, errcode(), errmsg(), ERROR, find_all_inheritors(), Constraint::fk_attrs, Constraint::fk_del_action, Constraint::fk_del_set_cols, Constraint::fk_matchtype, Constraint::fk_upd_action, GetForeignKeyCheckTriggers(), GETSTRUCT, HeapTupleIsValid, i, INDEX_MAX_KEYS, Constraint::initdeferred, Constraint::initially_valid, InvalidOid, lappend(), lappend_oid(), lfirst, lfirst_node, lfirst_oid, list_member_oid(), Constraint::location, makeNode, makeString(), NameStr, NIL, NoLock, ObjectAddressSet, ObjectIdGetDatum(), Constraint::old_conpfeqop, Constraint::old_pktable_oid, Constraint::pk_attrs, Constraint::pktable, pstrdup(), RelationData::rd_rel, recordDependencyOn(), RelationGetDescr, RelationGetFKeyList(), RelationGetNamespace, RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), RowExclusiveLock, SearchSysCache1(), ShareRowExclusiveLock, Constraint::skip_validation, table_close(), table_open(), tryAttachPartitionForeignKey(), and TupleDescAttr.
Referenced by CloneForeignKeyConstraints().
|
static |
Definition at line 10934 of file tablecmds.c.
References Assert, CloneFkReferenced(), CloneFkReferencing(), and RelationData::rd_rel.
Referenced by attachPartitionTable(), and DefineRelation().
Definition at line 19708 of file tablecmds.c.
References ALLOCSET_SMALL_SIZES, AllocSetContextCreate, CreateTrigStmt::args, BTEqualStrategyNumber, CreateTrigStmt::columns, CreateTrigStmt::constrrel, CreateTriggerFiringOn(), CurrentMemoryContext, DatumGetByteaPP, CreateTrigStmt::deferrable, elog, ERROR, CreateTrigStmt::events, CreateTrigStmt::funcname, GETSTRUCT, heap_getattr(), HeapTupleIsValid, i, CreateTrigStmt::initdeferred, InvalidOid, CreateTrigStmt::isconstraint, sort-test::key, lappend(), makeNode, makeString(), map_partition_varattnos(), MemoryContextDelete(), MemoryContextReset(), MemoryContextSwitchTo(), NameStr, NIL, ObjectIdGetDatum(), OidIsValid, PRS2_NEW_VARNO, PRS2_OLD_VARNO, pstrdup(), RelationData::rd_att, CreateTrigStmt::relation, RelationGetDescr, RelationGetRelationName, RelationGetRelid, CreateTrigStmt::replace, CreateTrigStmt::row, RowExclusiveLock, ScanKeyInit(), stringToNode(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), TextDatumGetCString, CreateTrigStmt::timing, CreateTrigStmt::transitionRels, CreateTrigStmt::trigname, TupleDescAttr, value, VARDATA_ANY, and CreateTrigStmt::whenClause.
Referenced by attachPartitionTable(), and DefineRelation().
|
static |
Definition at line 18731 of file tablecmds.c.
References arg, Assert, bms_is_member(), bms_next_member(), CheckAttributeType(), CHKATYPE_IS_PARTKEY, PartitionElem::collation, contain_mutable_functions(), ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, PartitionElem::expr, exprCollation(), expression_planner(), exprType(), FirstLowInvalidHeapAttributeNumber, format_type_be(), get_attname(), get_collation_oid(), GetDefaultOpClass(), GETSTRUCT, HeapTupleIsValid, i, IsA, lappend(), lfirst_node, PartitionElem::location, PartitionElem::name, NIL, OidIsValid, PartitionElem::opclass, parser_errposition(), PARTITION_STRATEGY_HASH, pull_varattnos(), RelationGetDescr, RelationGetRelid, ReleaseSysCache(), ResolveOpClass(), SearchSysCacheAttName(), snprintf, TupleDescAttr, and type_is_collatable().
Referenced by DefineRelation().
|
static |
Definition at line 19042 of file tablecmds.c.
References canonicalize_qual(), ConstrCheck::ccbin, ConstrCheck::ccvalid, TupleConstr::check, eval_const_expressions(), for(), i, list_concat(), list_copy(), make_ands_implicit(), TupleConstr::num_check, predicate_implied_by(), RelationGetDescr, and stringToNode().
Referenced by NotNullImpliedByRelConstraints(), and PartConstraintImpliedByRelConstraint().
Definition at line 16405 of file tablecmds.c.
References a, b, decompile_conbin(), and GETSTRUCT.
Referenced by MergeConstraintsIntoExisting().
|
static |
Definition at line 12654 of file tablecmds.c.
References CreateTrigStmt::args, CreateTrigStmt::columns, CommandCounterIncrement(), CreateTrigStmt::constrrel, CreateTrigger(), Constraint::deferrable, CreateTrigStmt::deferrable, CreateTrigStmt::events, CreateTrigStmt::funcname, Constraint::initdeferred, CreateTrigStmt::initdeferred, InvalidOid, CreateTrigStmt::isconstraint, makeNode, NIL, ObjectAddress::objectId, CreateTrigStmt::relation, CreateTrigStmt::replace, CreateTrigStmt::row, SystemFuncName(), CreateTrigStmt::timing, CreateTrigStmt::transitionRels, CreateTrigStmt::trigname, and CreateTrigStmt::whenClause.
Referenced by createForeignKeyCheckTriggers().
|
static |
Definition at line 12717 of file tablecmds.c.
References CreateTrigStmt::args, CreateTrigStmt::columns, CommandCounterIncrement(), CreateTrigStmt::constrrel, CreateTrigger(), Constraint::deferrable, CreateTrigStmt::deferrable, elog, ERROR, CreateTrigStmt::events, Constraint::fk_del_action, Constraint::fk_upd_action, FKCONSTR_ACTION_CASCADE, FKCONSTR_ACTION_NOACTION, FKCONSTR_ACTION_RESTRICT, FKCONSTR_ACTION_SETDEFAULT, FKCONSTR_ACTION_SETNULL, CreateTrigStmt::funcname, Constraint::initdeferred, CreateTrigStmt::initdeferred, InvalidOid, CreateTrigStmt::isconstraint, makeNode, NIL, ObjectAddress::objectId, CreateTrigStmt::relation, RelationGetRelid, CreateTrigStmt::replace, CreateTrigStmt::row, SystemFuncName(), CreateTrigStmt::timing, CreateTrigStmt::transitionRels, CreateTrigStmt::trigname, and CreateTrigStmt::whenClause.
Referenced by addFkRecurseReferenced(), and DetachPartitionFinalize().
|
static |
Definition at line 12854 of file tablecmds.c.
References CreateFKCheckTrigger().
Referenced by addFkRecurseReferencing().
Definition at line 16311 of file tablecmds.c.
References BTEqualStrategyNumber, ereport, errcode(), errmsg(), ERROR, GETSTRUCT, HeapTupleIsValid, sort-test::key, MergeAttributesIntoExisting(), MergeConstraintsIntoExisting(), ObjectIdGetDatum(), RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, ScanKeyInit(), StoreCatalogInheritance1(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by ATExecAddInherit(), and attachPartitionTable().
|
static |
Definition at line 21218 of file tablecmds.c.
References PlannedStmt::canSetTag, CMD_UTILITY, PlannedStmt::commandType, CreateStmt::constraints, context, CREATE_TABLE_LIKE_ALL, CREATE_TABLE_LIKE_IDENTITY, CREATE_TABLE_LIKE_INDEXES, CreateStmt::if_not_exists, CreateStmt::inhRelations, InvalidOid, lappend(), makeNode, NIL, None_Receiver, CreateStmt::oncommit, ONCOMMIT_NOOP, TableLikeClause::options, CreateStmt::options, PROCESS_UTILITY_SUBCOMMAND, ProcessUtility(), TableLikeClause::relation, CreateStmt::relation, TableLikeClause::relationOid, PlannedStmt::stmt_len, PlannedStmt::stmt_location, CreateStmt::tableElts, CreateStmt::tablespacename, and PlannedStmt::utilityStmt.
Referenced by ATExecMergePartitions(), and ATExecSplitPartition().
|
static |
Definition at line 20977 of file tablecmds.c.
References SplitPartitionContext::bistate, SplitPartitionContext::dstslot, ExecStoreAllNullTuple(), GetBulkInsertState(), MakeSingleTupleTableSlot(), palloc0(), SplitPartitionContext::partRel, RelationGetDescr, and table_slot_callbacks().
Referenced by moveSplitTableRows().
Definition at line 16380 of file tablecmds.c.
References DirectFunctionCall2, elog, ERROR, GETSTRUCT, heap_getattr(), ObjectIdGetDatum(), pg_get_expr(), and TextDatumGetCString.
Referenced by constraints_equivalent().
ObjectAddress DefineRelation | ( | CreateStmt * | stmt, |
char | relkind, | ||
Oid | ownerId, | ||
ObjectAddress * | typaddress, | ||
const char * | queryString | ||
) |
Definition at line 701 of file tablecmds.c.
References AccessExclusiveLock, AccessShareLock, ACL_CREATE, ACL_USAGE, aclcheck_error(), aclcheck_error_type(), ACLCHECK_OK, addNSItemToQuery(), addRangeTableEntryForRelation(), AddRelationNewConstraints(), AddRelationNotNullConstraints(), allowSystemTableMods, Assert, RawColumnDefault::attnum, CookedConstraint::attnum, attnum, build_attrmap_by_name(), BuildDescForRelation(), check_default_partition_contents(), check_new_partition_bound(), CloneForeignKeyConstraints(), CloneRowTriggersToPartition(), CommandCounterIncrement(), ComputePartitionAttrs(), CookedConstraint::conoid, CONSTR_DEFAULT, CookedConstraint::contype, ColumnDef::cooked_default, default_table_access_method, DefineIndex(), elog, ereport, errcode(), errdetail(), errmsg(), ERROR, CookedConstraint::expr, generateClonedIndexStmt(), RawColumnDefault::generated, ColumnDef::generated, get_default_oid_from_partdesc(), get_rel_name(), get_rel_relam(), get_rel_tablespace(), get_table_am_oid(), get_tablespace_name(), get_tablespace_oid(), GetDefaultTablespace(), GetUserId(), heap_create_with_catalog(), HEAP_RELOPT_NAMESPACES, heap_reloptions(), index_close(), index_open(), CookedConstraint::inhcount, InSecurityRestrictedOperation(), InvalidOid, CookedConstraint::is_local, CookedConstraint::is_no_inherit, lappend(), lappend_oid(), lfirst, lfirst_int, lfirst_oid, linitial_oid, list_concat(), list_free(), list_length(), list_member_oid(), make_parsestate(), MergeAttributes(), RawColumnDefault::missingMode, MyDatabaseTableSpace, CookedConstraint::name, NAMEDATALEN, NIL, NoLock, object_aclcheck(), OBJECT_TABLESPACE, ObjectAddressSet, OidIsValid, ONCOMMIT_NOOP, ParseState::p_sourcetext, palloc(), PARTITION_MAX_KEYS, partitioned_table_reloptions(), RangeVarGetAndCheckCreationNamespace(), RangeVarGetRelid, RawColumnDefault::raw_default, ColumnDef::raw_default, RelationData::rd_index, RelationData::rd_rel, relation_close(), relation_open(), RelationGetDescr, RelationGetIndexList(), RelationGetPartitionDesc(), RelationGetRelationName, RelationGetRelid, relname, set_attnotnull(), ShareUpdateExclusiveLock, CookedConstraint::skip_validation, stmt, StoreCatalogInheritance(), StorePartitionBound(), StorePartitionKey(), strlcpy(), table_close(), table_open(), transformPartitionBound(), transformPartitionSpec(), transformRelOptions(), RelationData::trigdesc, TupleDescAttr, typenameTypeId(), and view_reloptions().
Referenced by create_ctas_internal(), DefineCompositeType(), DefineSequence(), DefineVirtualRelation(), and ProcessUtilitySlow().
|
static |
Definition at line 21002 of file tablecmds.c.
References SplitPartitionContext::bistate, SplitPartitionContext::dstslot, ExecDropSingleTupleTableSlot(), FreeBulkInsertState(), SplitPartitionContext::partRel, pfree(), and table_finish_bulk_insert().
Referenced by moveSplitTableRows().
Definition at line 20310 of file tablecmds.c.
References ATAddCheckNNConstraint(), ATGetQueueEntry(), Constraint::conname, CONSTR_CHECK, Constraint::contype, Constraint::cooked_expr, eval_const_expressions(), Constraint::initially_valid, Constraint::is_no_inherit, Constraint::location, make_ands_explicit(), makeNode, nodeToString(), PartConstraintImpliedByRelConstraint(), Constraint::raw_expr, RelationGetPartitionQual(), ShareUpdateExclusiveLock, and Constraint::skip_validation.
Referenced by ATExecDetachPartition().
|
static |
Definition at line 20036 of file tablecmds.c.
References AccessExclusiveLock, Assert, ATExecDropIdentity(), CacheInvalidateRelcache(), CacheInvalidateRelcacheByRelid(), CatalogTupleUpdate(), CommandCounterIncrement(), ForeignKeyCacheInfo::confrelid, Constraint::conname, ForeignKeyCacheInfo::conoid, ForeignKeyCacheInfo::conrelid, ConstraintSetParentConstraint(), Constraint::contype, copyObject, createForeignKeyActionTriggers(), Constraint::deferrable, deleteDependencyRecordsForClass(), DEPENDENCY_INTERNAL, DROP_RESTRICT, DropClonedTriggersFromPartition(), elog, ERROR, find_all_inheritors(), Constraint::fk_attrs, Constraint::fk_del_action, Constraint::fk_del_set_cols, Constraint::fk_matchtype, Constraint::fk_upd_action, get_partition_parent(), get_relation_idx_constraint_oid(), GetForeignKeyCheckTriggers(), GetParentedForeignKeyRefs(), GETSTRUCT, has_superclass(), heap_freetuple(), heap_modify_tuple(), HeapTupleIsValid, idx(), index_close(), index_open(), IndexGetRelation(), IndexSetParentIndex(), Constraint::initdeferred, Constraint::initially_valid, InvalidOid, lfirst, lfirst_oid, list_free_deep(), Constraint::location, makeNode, NameStr, NIL, NoLock, ObjectAddressSet, ObjectIdGetDatum(), OidIsValid, Constraint::old_conpfeqop, Constraint::old_pktable_oid, performDeletion(), Constraint::pk_attrs, Constraint::pktable, pstrdup(), RelationData::rd_att, RelationData::rd_rel, RelationGetDescr, RelationGetFKeyList(), RelationGetIndexList(), RelationGetNumberOfAttributes, RelationGetRelid, ReleaseSysCache(), RemoveInheritance(), RowExclusiveLock, SearchSysCache1(), SearchSysCacheCopy1, Constraint::skip_validation, HeapTupleData::t_self, table_close(), table_open(), TriggerSetParentTrigger(), TupleDescAttr, and update_default_partition_oid().
Referenced by ATExecDetachPartition(), ATExecDetachPartitionFinalize(), ATExecMergePartitions(), and ATExecSplitPartition().
|
static |
Definition at line 17129 of file tablecmds.c.
References BTEqualStrategyNumber, CatalogTupleDelete(), GETSTRUCT, HeapTupleIsValid, Int32GetDatum(), sort-test::key, ObjectIdGetDatum(), RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecAddOf(), ATExecDropOf(), and RemoveInheritance().
|
static |
Definition at line 20351 of file tablecmds.c.
References add_exact_object_address(), BTEqualStrategyNumber, CommandCounterIncrement(), deleteDependencyRecordsForClass(), DEPENDENCY_PARTITION_PRI, DEPENDENCY_PARTITION_SEC, DROP_RESTRICT, free_object_addresses(), GETSTRUCT, HeapTupleIsValid, new_object_addresses(), ObjectAddressSet, ObjectIdGetDatum(), OidIsValid, PERFORM_DELETION_INTERNAL, performMultipleDeletions(), RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by DetachPartitionFinalize().
|
static |
Definition at line 12941 of file tablecmds.c.
References AccessExclusiveLock, ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_HASNULL, ARR_NDIM, AT_DropConstraint, ATSimplePermissions(), ATT_FOREIGN_TABLE, ATT_TABLE, attname, attnum, bms_is_member(), BTEqualStrategyNumber, CatalogTupleUpdate(), check_stack_depth(), CheckTableNotInUse(), CommandCounterIncrement(), CStringGetDatum(), DatumGetArrayTypeP, DROP_RESTRICT, elog, ereport, errcode(), errhint(), errmsg(), ERROR, extractNotNullColumn(), find_inheritance_children(), findNotNullConstraint(), findNotNullConstraintAttnum(), FirstLowInvalidHeapAttributeNumber, foreach_int, foreach_oid, foreach_ptr, get_attname(), GETSTRUCT, heap_copytuple(), heap_freetuple(), heap_getattr(), HeapTupleIsValid, i, INDEX_ATTR_BITMAP_IDENTITY_KEY, INDEX_ATTR_BITMAP_PRIMARY_KEY, InvalidObjectAddress, InvalidOid, lappend(), lappend_int(), lappend_oid(), list_make1_int, list_member_oid(), NameStr, NIL, NoLock, ObjectAddressSet, ObjectIdGetDatum(), performDeletion(), RelationData::rd_rel, RelationGetDescr, RelationGetIndexAttrBitmap(), RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), RowExclusiveLock, ScanKeyInit(), SearchSysCacheAttNum(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), table_open(), and TupleDescAttr.
Referenced by ATExecDropConstraint(), and ATExecDropNotNull().
Definition at line 1410 of file tablecmds.c.
References Assert, dropmsgstringarray, ereport, errcode(), errmsg(), ERROR, dropmsgstrings::kind, LookupNamespaceNoError(), dropmsgstrings::nonexistent_code, dropmsgstrings::nonexistent_msg, NOTICE, OidIsValid, RangeVar::relname, RangeVar::schemaname, and dropmsgstrings::skipping_msg.
Referenced by RemoveRelations().
|
static |
Definition at line 1458 of file tablecmds.c.
References _, Assert, dropmsgstrings::drophint_msg, dropmsgstringarray, ereport, errcode(), errhint(), errmsg(), ERROR, dropmsgstrings::kind, dropmsgstrings::nota_msg, and relname.
Referenced by RangeVarCallbackForDropRelation().
void ExecuteTruncate | ( | TruncateStmt * | stmt | ) |
Definition at line 1808 of file tablecmds.c.
References AccessExclusiveLock, ereport, errcode(), errhint(), errmsg(), ERROR, ExecuteTruncateGuts(), find_all_inheritors(), RangeVar::inh, lappend(), lappend_oid(), lfirst, lfirst_oid, list_member_oid(), NIL, NoLock, RangeVarCallbackForTruncate(), RangeVarGetRelidExtended(), RelationData::rd_rel, RELATION_IS_OTHER_TEMP, RelationGetRelid, RelationIsLogicallyLogged, stmt, table_close(), table_open(), truncate_check_activity(), and truncate_check_rel().
Referenced by standard_ProcessUtility().
void ExecuteTruncateGuts | ( | List * | explicit_rels, |
List * | relids, | ||
List * | relids_logged, | ||
DropBehavior | behavior, | ||
bool | restart_seqs, | ||
bool | run_as_table_owner | ||
) |
Definition at line 1932 of file tablecmds.c.
References AccessExclusiveLock, aclcheck_error(), ACLCHECK_NOT_OWNER, AfterTriggerBeginQuery(), AfterTriggerEndQuery(), Assert, CheckTableForSerializableConflictIn(), CreateExecutorState(), CurrentMemoryContext, xl_heap_truncate::dbId, DROP_CASCADE, DROP_RESTRICT, HASHCTL::entrysize, ereport, errmsg(), EState::es_opened_result_relations, ExecASTruncateTriggers(), ExecBSTruncateTriggers(), FdwRoutine::ExecForeignTruncate, xl_heap_truncate::flags, FreeExecutorState(), GetCurrentSubTransactionId(), GetFdwRoutineByServerId(), GetForeignServerIdByRelId(), getOwnedSequences(), GetUserId(), HASH_BLOBS, HASH_CONTEXT, hash_create(), hash_destroy(), HASH_ELEM, HASH_ENTER, hash_search(), hash_seq_init(), hash_seq_search(), HASHCTL::hcxt, heap_truncate_check_FKs(), heap_truncate_find_FKs(), heap_truncate_one_rel(), i, InitResultRelInfo(), HASHCTL::keysize, lappend(), lappend_oid(), lfirst, lfirst_oid, list_copy(), list_difference_ptr(), list_length(), MyDatabaseId, NIL, NoLock, NOTICE, xl_heap_truncate::nrelids, object_ownercheck(), OBJECT_SEQUENCE, OidIsValid, palloc(), PG_END_TRY, PG_FINALLY, PG_TRY, pgstat_count_truncate(), RelationData::rd_createSubid, RelationData::rd_newRelfilelocatorSubid, RelationData::rd_rel, REINDEX_REL_PROCESS_TOAST, reindex_relation(), relation_close(), relation_open(), RelationGetRelationName, RelationGetRelid, RelationIsLogicallyLogged, RelationSetNewRelfilenumber(), ForeignTruncateInfo::rels, ResetSequence(), RestoreUserContext(), ResultRelInfo::ri_RelationDesc, ForeignTruncateInfo::serverid, SizeOfHeapTruncate, SwitchToUntrustedUser(), table_close(), table_open(), truncate_check_activity(), truncate_check_perms(), truncate_check_rel(), XLH_TRUNCATE_CASCADE, XLH_TRUNCATE_RESTART_SEQS, XLOG_HEAP_TRUNCATE, XLOG_INCLUDE_ORIGIN, XLogBeginInsert(), XLogInsert(), XLogLogicalInfoActive, XLogRegisterData(), and XLogSetRecordFlags().
Referenced by apply_handle_truncate(), and ExecuteTruncate().
void find_composite_type_dependencies | ( | Oid | typeOid, |
Relation | origRelation, | ||
const char * | origTypeName | ||
) |
Definition at line 6808 of file tablecmds.c.
References AccessShareLock, BTEqualStrategyNumber, check_stack_depth(), ereport, errcode(), errmsg(), ERROR, GETSTRUCT, HeapTupleIsValid, sort-test::key, NameStr, TupleDescData::natts, ObjectIdGetDatum(), OidIsValid, RelationData::rd_rel, relation_close(), relation_open(), RelationGetDescr, RelationGetRelationName, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_open(), and TupleDescAttr.
Referenced by ATPrepAlterColumnType(), ATRewriteTables(), and get_rels_with_domain().
|
static |
Definition at line 6966 of file tablecmds.c.
References AccessShareLock, BTEqualStrategyNumber, DROP_RESTRICT, ereport, errcode(), errhint(), errmsg(), ERROR, ForwardScanDirection, GETSTRUCT, heap_getnext(), sort-test::key, lappend_oid(), NIL, ObjectIdGetDatum(), ScanKeyInit(), table_beginscan_catalog(), table_close(), table_endscan(), and table_open().
Referenced by ATTypedTableRecursion(), and renameatt_internal().
|
static |
Definition at line 3559 of file tablecmds.c.
References i, and lfirst_node.
Referenced by MergeAttributes().
|
static |
Definition at line 12496 of file tablecmds.c.
References COERCION_IMPLICIT, COERCION_PATH_NONE, COERCION_PATH_RELABELTYPE, elog, ERROR, find_coercion_pathway(), and InvalidOid.
Referenced by ATAddForeignKeyConstraint().
|
static |
Definition at line 20889 of file tablecmds.c.
References CompressionMethodIsValid, CompressionNameToMethod(), ereport, errcode(), errmsg(), ERROR, format_type_be(), InvalidCompressionMethod, and TypeIsToastable.
Referenced by ATExecSetCompression(), and BuildDescForRelation().
|
static |
Definition at line 20927 of file tablecmds.c.
References ereport, errcode(), errmsg(), ERROR, format_type_be(), get_typstorage(), pg_strcasecmp(), and TypeIsToastable.
Referenced by ATExecSetStorage(), and BuildDescForRelation().
|
static |
Definition at line 11586 of file tablecmds.c.
References Assert, BTEqualStrategyNumber, elog, ERROR, GETSTRUCT, InvalidOid, sort-test::key, ObjectIdGetDatum(), OidIsValid, RI_FKey_trigger_type(), RI_TRIGGER_PK, ScanKeyInit(), systable_beginscan(), systable_endscan(), and systable_getnext().
Referenced by CloneFkReferenced().
|
static |
Definition at line 11647 of file tablecmds.c.
References Assert, BTEqualStrategyNumber, elog, ERROR, GETSTRUCT, InvalidOid, sort-test::key, ObjectIdGetDatum(), OidIsValid, RI_FKey_trigger_type(), RI_TRIGGER_FK, ScanKeyInit(), systable_beginscan(), systable_endscan(), and systable_getnext().
Referenced by CloneFkReferencing(), DetachPartitionFinalize(), and tryAttachPartitionForeignKey().
Definition at line 20787 of file tablecmds.c.
References AccessShareLock, bms_is_empty, BTEqualStrategyNumber, CharGetDatum(), GETSTRUCT, INDEX_ATTR_BITMAP_KEY, InvalidOid, sort-test::key, lappend_oid(), NIL, ObjectIdGetDatum(), OidIsValid, RelationGetIndexAttrBitmap(), RelationGetIndexList(), RelationGetRelid, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by ATDetachCheckNoForeignKeyRefs(), and DetachPartitionFinalize().
|
static |
Definition at line 16078 of file tablecmds.c.
References FlushRelationBuffers(), INIT_FORKNUM, log_smgrcreate(), MAIN_FORKNUM, MAX_FORKNUM, RelationData::rd_rel, RelationCopyStorage(), RelationCreateStorage(), RelationDropStorage(), RelationGetSmgr(), RelationIsPermanent, smgrclose(), smgrcreate(), and smgrexists().
Referenced by ATExecSetTableSpace().
Definition at line 16804 of file tablecmds.c.
References Assert, BTEqualStrategyNumber, CatalogTupleUpdate(), ereport, errcode(), ERRCODE_UNDEFINED_TABLE, errhint(), errmsg(), ERROR, get_namespace_name(), get_rel_name(), GETSTRUCT, heap_copytuple(), heap_freetuple(), HeapTupleIsValid, sort-test::key, ObjectIdGetDatum(), RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecDetachPartition().
|
static |
Definition at line 2492 of file tablecmds.c.
References aclcheck_error(), ACLCHECK_NOT_OWNER, Assert, CookedConstraint::attnum, attnum, AttrMap::attnums, bms_add_member(), bms_is_member(), ConstrCheck::ccname, TupleConstr::check, CheckTableNotInUse(), ColumnDef::colname, ColumnDef::compression, CompressionMethodIsValid, CookedConstraint::conoid, TupleDescData::constr, CONSTR_NOTNULL, ColumnDef::constraints, CookedConstraint::contype, ColumnDef::cooked_default, elog, equal(), ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, CookedConstraint::expr, findAttrByName(), FirstLowInvalidHeapAttributeNumber, forboth, free_attrmap(), ColumnDef::generated, get_relkind_objtype(), GetCompressionMethodName(), GetUserId(), i, ColumnDef::identity, INDEX_ATTR_BITMAP_PRIMARY_KEY, CookedConstraint::inhcount, ColumnDef::inhcount, InvalidOid, ColumnDef::is_from_type, CookedConstraint::is_local, ColumnDef::is_local, CookedConstraint::is_no_inherit, ColumnDef::is_not_null, lappend(), lfirst, lfirst_node, lfirst_oid, list_delete_nth_cell(), list_length(), list_nth_node, make_attrmap(), makeColumnDef(), map_variable_attnos(), MaxHeapAttributeNumber, MergeCheckConstraint(), MergeChildAttribute(), MergeInheritedAttribute(), name, CookedConstraint::name, NameStr, TupleDescData::natts, NIL, NoLock, TupleConstr::num_check, object_ownercheck(), palloc(), pstrdup(), ColumnDef::raw_default, RelationData::rd_islocaltemp, RelationData::rd_rel, RelationGetDescr, RelationGetIndexAttrBitmap(), RelationGetNotNullConstraints(), RelationGetRelationName, RelationGetRelid, CookedConstraint::skip_validation, ColumnDef::storage, stringToNode(), table_close(), table_open(), TupleDescAttr, TupleDescGetDefault(), and ColumnDef::typeName.
Referenced by DefineRelation().
|
static |
Definition at line 16434 of file tablecmds.c.
References Assert, CatalogTupleUpdate(), ereport, errcode(), errmsg(), ERROR, findNotNullConstraintAttnum(), GETSTRUCT, heap_freetuple(), HeapTupleIsValid, NameStr, TupleDescData::natts, RelationData::rd_rel, RelationGetDescr, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, SearchSysCacheCopyAttName(), HeapTupleData::t_self, table_close(), table_open(), and TupleDescAttr.
Referenced by CreateInheritance().
Definition at line 3142 of file tablecmds.c.
References Assert, CONSTR_CHECK, CookedConstraint::contype, equal(), ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errmsg(), ERROR, CookedConstraint::expr, CookedConstraint::inhcount, lappend(), lfirst, name, CookedConstraint::name, palloc0_object, and pstrdup().
Referenced by MergeAttributes().
|
static |
Definition at line 3208 of file tablecmds.c.
References ColumnDef::colname, ColumnDef::compression, ColumnDef::cooked_default, ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, format_type_with_typemod(), ColumnDef::generated, get_collation_name(), GetColumnDefCollation(), ColumnDef::identity, ColumnDef::is_local, ColumnDef::is_not_null, list_nth_node, NOTICE, ColumnDef::raw_default, ColumnDef::storage, storage_name(), ColumnDef::typeName, and typenameTypeIdAndMod().
Referenced by MergeAttributes().
Definition at line 16564 of file tablecmds.c.
References Assert, BTEqualStrategyNumber, CatalogTupleUpdate(), constraints_equivalent(), ereport, errcode(), errdetail(), errmsg(), ERROR, extractNotNullColumn(), get_attname(), GETSTRUCT, heap_copytuple(), heap_freetuple(), HeapTupleIsValid, NameStr, ObjectIdGetDatum(), RelationData::rd_rel, RelationGetDescr, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by CreateInheritance().
|
static |
Definition at line 3369 of file tablecmds.c.
References ColumnDef::colname, ColumnDef::compression, ereport, errcode(), errdetail(), errmsg(), ERROR, format_type_with_typemod(), ColumnDef::generated, get_collation_name(), GetColumnDefCollation(), ColumnDef::inhcount, list_nth_node, NOTICE, ColumnDef::storage, storage_name(), ColumnDef::typeName, and typenameTypeIdAndMod().
Referenced by MergeAttributes().
|
static |
Definition at line 21402 of file tablecmds.c.
References TupleConversionMap::attrMap, CHECK_FOR_INTERRUPTS, convert_tuples_by_name(), ExecClearTuple(), ExecDropSingleTupleTableSlot(), ExecStoreAllNullTuple(), ExecStoreVirtualTuple(), execute_attr_map_slot(), ForwardScanDirection, free_conversion_map(), FreeBulkInsertState(), GetBulkInsertState(), GetCurrentCommandId(), GetLatestSnapshot(), lfirst, MakeSingleTupleTableSlot(), RegisterSnapshot(), RelationGetDescr, slot_getallattrs(), table_beginscan(), table_endscan(), table_finish_bulk_insert(), TABLE_INSERT_SKIP_FSM, table_scan_getnextslot(), table_slot_callbacks(), table_tuple_insert(), TupleTableSlot::tts_isnull, TupleTableSlot::tts_nvalid, TupleTableSlot::tts_values, and UnregisterSnapshot().
Referenced by ATExecMergePartitions().
|
static |
Definition at line 21022 of file tablecmds.c.
References AccessExclusiveLock, Assert, TupleConversionMap::attrMap, SinglePartitionSpec::bound, CHECK_FOR_INTERRUPTS, convert_tuples_by_name(), CreateExecutorState(), createSplitPartitionContext(), deleteSplitPartitionContext(), ExprContext::ecxt_scantuple, ereport, errcode(), errmsg(), ERROR, errtable(), eval_const_expressions(), ExecCheck(), ExecClearTuple(), ExecDropSingleTupleTableSlot(), ExecPrepareExpr(), ExecStoreVirtualTuple(), execute_attr_map_slot(), forboth, ForwardScanDirection, free_conversion_map(), FreeExecutorState(), get_qual_from_partbound(), GetCurrentCommandId(), GetLatestSnapshot(), GetPerTupleExprContext, GetPerTupleMemoryContext, PartitionBoundSpec::is_default, lappend(), lfirst, linitial, list_head(), list_make1, make_ands_explicit(), MakeSingleTupleTableSlot(), map_partition_varattnos(), MemoryContextSwitchTo(), NIL, NoLock, OidIsValid, SplitPartitionContext::partRel, RegisterSnapshot(), RelationGetDescr, ResetExprContext, slot_getallattrs(), table_beginscan(), table_close(), table_endscan(), TABLE_INSERT_SKIP_FSM, table_open(), table_scan_getnextslot(), table_slot_callbacks(), table_tuple_insert(), TupleTableSlot::tts_isnull, TupleTableSlot::tts_nvalid, TupleTableSlot::tts_values, and UnregisterSnapshot().
Referenced by ATExecSplitPartition().
|
static |
Definition at line 8050 of file tablecmds.c.
References NullTest::arg, ConstraintImpliedByRelConstraint(), DEBUG1, ereport, errmsg_internal(), IS_NOT_NULL, list_make1, NullTest::location, makeNode, makeVar(), NameStr, NIL, NullTest::nulltesttype, and RelationGetRelationName.
Referenced by set_attnotnull().
Definition at line 18989 of file tablecmds.c.
References NullTest::arg, ConstraintImpliedByRelConstraint(), TupleConstr::has_not_null, i, IS_NOT_NULL, lappend(), NullTest::location, makeNode, makeVar(), TupleDescData::natts, NIL, NullTest::nulltesttype, RelationData::rd_att, RelationGetDescr, and TupleDescAttr.
Referenced by check_default_partition_contents(), DetachAddConstraintIfNeeded(), and QueuePartitionConstraintValidation().
void PreCommit_on_commit_actions | ( | void | ) |
Definition at line 18266 of file tablecmds.c.
References add_exact_object_address(), Assert, ObjectAddress::classId, OnCommitItem::deleting_subid, DROP_CASCADE, GetTransactionSnapshot(), heap_truncate(), InvalidSubTransactionId, lappend_oid(), lfirst, lfirst_oid, MyXactFlags, new_object_addresses(), NIL, object_address_present(), on_commits, OnCommitItem::oncommit, ONCOMMIT_DELETE_ROWS, ONCOMMIT_DROP, ONCOMMIT_NOOP, ONCOMMIT_PRESERVE_ROWS, PERFORM_DELETION_INTERNAL, PERFORM_DELETION_QUIETLY, performMultipleDeletions(), PopActiveSnapshot(), PushActiveSnapshot(), OnCommitItem::relid, and XACT_FLAGS_ACCESSEDTEMPNAMESPACE.
Referenced by CommitTransaction(), and PrepareTransaction().
|
static |
Definition at line 19099 of file tablecmds.c.
References AccessExclusiveLock, Assert, ATGetQueueEntry(), DEBUG1, ereport, errmsg_internal(), i, linitial, map_partition_varattnos(), NoLock, PartitionDescData::nparts, PartitionDescData::oids, PartConstraintImpliedByRelConstraint(), AlteredTableInfo::partition_constraint, RelationData::rd_rel, RelationGetPartitionDesc(), RelationGetRelationName, table_close(), table_open(), and AlteredTableInfo::validate_default.
Referenced by ATExecAttachPartition().
|
static |
Definition at line 18532 of file tablecmds.c.
References ACL_CREATE, aclcheck_error(), ACLCHECK_NOT_OWNER, ACLCHECK_OK, allowSystemTableMods, arg, elog, ereport, errcode(), errhint(), errmsg(), ERROR, get_namespace_name(), get_rel_relkind(), get_relkind_objtype(), GETSTRUCT, GetUserId(), HeapTupleIsValid, IsA, IsSystemClass(), nodeTag, object_aclcheck(), OBJECT_FOREIGN_TABLE, OBJECT_INDEX, OBJECT_MATVIEW, object_ownercheck(), OBJECT_SCHEMA, OBJECT_SEQUENCE, OBJECT_TABLE, OBJECT_TYPE, OBJECT_VIEW, ObjectIdGetDatum(), ReleaseSysCache(), RangeVar::relname, SearchSysCache1(), and stmt.
Referenced by AlterTableLookupRelation(), AlterTableNamespace(), and RenameRelation().
|
static |
Definition at line 20424 of file tablecmds.c.
References AccessShareLock, arg, ereport, errcode(), errmsg(), ERROR, GETSTRUCT, HeapTupleIsValid, IndexGetRelation(), InvalidOid, LockRelationOid(), ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), RangeVar::relname, SearchSysCache1(), and UnlockRelationOid().
Referenced by ATExecAttachPartitionIdx().
|
static |
Definition at line 1649 of file tablecmds.c.
References AccessExclusiveLock, aclcheck_error(), ACLCHECK_NOT_OWNER, allowSystemTableMods, arg, DropErrorMsgWrongType(), ereport, errcode(), errmsg(), ERROR, DropRelationCallbackState::expected_relkind, get_partition_parent(), get_relkind_objtype(), GETSTRUCT, GetUserId(), DropRelationCallbackState::heap_lockmode, HeapTupleIsValid, IndexGetRelation(), InvalidOid, IsSystemClass(), LockRelationOid(), object_ownercheck(), ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), RangeVar::relname, SearchSysCache1(), and UnlockRelationOid().
Referenced by RemoveRelations().
|
static |
Definition at line 3923 of file tablecmds.c.
References GETSTRUCT, HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), renameatt_check(), and SearchSysCache1().
Referenced by renameatt(), and RenameConstraint().
|
static |
Definition at line 18476 of file tablecmds.c.
References elog, ERROR, GETSTRUCT, HeapTupleIsValid, ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), SearchSysCache1(), truncate_check_perms(), and truncate_check_rel().
Referenced by ExecuteTruncate().
void RangeVarCallbackMaintainsTable | ( | const RangeVar * | relation, |
Oid | relId, | ||
Oid | oldRelId, | ||
void * | arg | ||
) |
Definition at line 18440 of file tablecmds.c.
References ACL_MAINTAIN, aclcheck_error(), ACLCHECK_OK, ereport, errcode(), errmsg(), ERROR, get_rel_relkind(), get_relkind_objtype(), GetUserId(), OidIsValid, pg_class_aclcheck(), and RangeVar::relname.
Referenced by cluster(), ExecRefreshMatView(), and ReindexTable().
void RangeVarCallbackOwnsRelation | ( | const RangeVar * | relation, |
Oid | relId, | ||
Oid | oldRelId, | ||
void * | arg | ||
) |
Definition at line 18500 of file tablecmds.c.
References aclcheck_error(), ACLCHECK_NOT_OWNER, allowSystemTableMods, elog, ereport, errcode(), errmsg(), ERROR, get_rel_relkind(), get_relkind_objtype(), GETSTRUCT, GetUserId(), HeapTupleIsValid, IsSystemClass(), object_ownercheck(), ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), RangeVar::relname, and SearchSysCache1().
Referenced by AlterSequence(), and ProcessUtilitySlow().
|
static |
Definition at line 14778 of file tablecmds.c.
References AT_ReAddComment, CommentStmt::comment, copyObject, AlterTableCmd::def, get_namespace_name(), GetComment(), lappend(), list_make2, list_make3, makeNode, makeString(), makeTypeNameFromNameList(), CommentStmt::object, OBJECT_DOMCONSTRAINT, OBJECT_TABCONSTRAINT, CommentStmt::objtype, pstrdup(), RelationGetNamespace, RelationGetRelationName, AlteredTableInfo::subcmds, and AlterTableCmd::subtype.
Referenced by ATPostAlterTypeParse().
|
static |
Definition at line 20640 of file tablecmds.c.
References ereport, errcode(), errdetail(), errmsg(), ERROR, index_get_partition(), OidIsValid, RelationGetRelationName, and RelationGetRelid.
Referenced by ATExecAttachPartitionIdx().
void register_on_commit_action | ( | Oid | relid, |
OnCommitAction | action | ||
) |
Definition at line 18207 of file tablecmds.c.
References generate_unaccent_rules::action, CacheMemoryContext, OnCommitItem::creating_subid, OnCommitItem::deleting_subid, GetCurrentSubTransactionId(), InvalidSubTransactionId, lcons(), MemoryContextSwitchTo(), on_commits, OnCommitItem::oncommit, ONCOMMIT_NOOP, ONCOMMIT_PRESERVE_ROWS, palloc(), and OnCommitItem::relid.
Referenced by heap_create_with_catalog().
|
static |
Definition at line 17367 of file tablecmds.c.
References CacheInvalidateRelcache(), CatalogTupleUpdate(), elog, ERROR, GETSTRUCT, heap_freetuple(), HeapTupleIsValid, InvalidOid, InvokeObjectPostAlterHookArg, lfirst_oid, ObjectIdGetDatum(), RelationGetIndexList(), RelationGetRelationName, RelationGetRelid, RowExclusiveLock, SearchSysCacheCopy1, HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecReplicaIdentity().
|
static |
Definition at line 14027 of file tablecmds.c.
References Assert, AT_AlterColumnType, AT_SetExpression, attnum, BTEqualStrategyNumber, ObjectAddress::classId, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, get_attname(), get_rel_relkind(), GetAttrDefaultColumnAddress(), getObjectDescription(), GETSTRUCT, HeapTupleIsValid, Int32GetDatum(), sort-test::key, NoLock, ObjectAddress::objectId, ObjectIdGetDatum(), ObjectAddress::objectSubId, RelationGetRelid, RememberConstraintForRebuilding(), RememberIndexForRebuilding(), RememberStatisticsForRebuilding(), RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), and table_open().
Referenced by ATExecAlterColumnType(), and ATExecSetExpression().
|
static |
Definition at line 14253 of file tablecmds.c.
References AlteredTableInfo::clusterOnIndex, elog, ERROR, get_index_isclustered(), get_rel_name(), and AlteredTableInfo::relid.
Referenced by RememberConstraintForRebuilding(), and RememberIndexForRebuilding().
|
static |
Definition at line 14269 of file tablecmds.c.
References AlteredTableInfo::changedConstraintDefs, AlteredTableInfo::changedConstraintOids, get_constraint_index(), lappend(), lappend_oid(), list_member_oid(), OidIsValid, pg_get_constraintdef_command(), RememberClusterOnForRebuilding(), and RememberReplicaIdentityForRebuilding().
Referenced by RememberAllDependentForRebuilding(), and RememberIndexForRebuilding().
|
static |
Definition at line 14309 of file tablecmds.c.
References AlteredTableInfo::changedIndexDefs, AlteredTableInfo::changedIndexOids, get_index_constraint(), lappend(), lappend_oid(), list_member_oid(), OidIsValid, pg_get_indexdef_string(), RememberClusterOnForRebuilding(), RememberConstraintForRebuilding(), and RememberReplicaIdentityForRebuilding().
Referenced by RememberAllDependentForRebuilding().
|
static |
Definition at line 14238 of file tablecmds.c.
References elog, ERROR, get_index_isreplident(), get_rel_name(), AlteredTableInfo::relid, and AlteredTableInfo::replicaIdentityIndex.
Referenced by RememberConstraintForRebuilding(), and RememberIndexForRebuilding().
|
static |
Definition at line 14360 of file tablecmds.c.
References AlteredTableInfo::changedStatisticsDefs, AlteredTableInfo::changedStatisticsOids, lappend(), lappend_oid(), list_member_oid(), and pg_get_statisticsobjdef_string().
Referenced by RememberAllDependentForRebuilding().
void remove_on_commit_action | ( | Oid | relid | ) |
Definition at line 18243 of file tablecmds.c.
References OnCommitItem::deleting_subid, GetCurrentSubTransactionId(), lfirst, on_commits, and OnCommitItem::relid.
Referenced by heap_drop_with_catalog().
|
static |
Definition at line 16887 of file tablecmds.c.
References BTEqualStrategyNumber, CatalogTupleUpdate(), child_dependency_type, DeleteInheritsTuple(), drop_parent_dependency(), elog, ereport, errcode(), ERRCODE_UNDEFINED_TABLE, errmsg(), ERROR, extractNotNullColumn(), GETSTRUCT, heap_copytuple(), heap_freetuple(), HeapTupleIsValid, InvokeObjectPostAlterHookArg, sort-test::key, lappend(), lappend_int(), lfirst, lfirst_int, NameStr, NIL, ObjectIdGetDatum(), pstrdup(), RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, ScanKeyInit(), SearchSysCacheExistsAttName(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecDetachPartition(), ATExecDropInherit(), ATExecMergePartitions(), ATExecSplitPartition(), and DetachPartitionFinalize().
void RemoveRelations | ( | DropStmt * | drop | ) |
Definition at line 1485 of file tablecmds.c.
References AcceptInvalidationMessages(), AccessExclusiveLock, add_exact_object_address(), Assert, DropStmt::behavior, ObjectAddress::classId, DropStmt::concurrent, DROP_CASCADE, DropErrorMsgNonExistent(), elog, ereport, errcode(), errmsg(), ERROR, find_all_inheritors(), free_object_addresses(), InvalidOid, lfirst, list_length(), makeRangeVarFromNameList(), DropStmt::missing_ok, new_object_addresses(), OBJECT_FOREIGN_TABLE, OBJECT_INDEX, OBJECT_MATVIEW, OBJECT_SEQUENCE, OBJECT_TABLE, OBJECT_VIEW, ObjectAddress::objectId, DropStmt::objects, ObjectAddress::objectSubId, OidIsValid, PERFORM_DELETION_CONCURRENTLY, performMultipleDeletions(), RangeVarCallbackForDropRelation(), RangeVarGetRelidExtended(), RangeVar::relname, DropStmt::removeType, RVR_MISSING_OK, and ShareUpdateExclusiveLock.
Referenced by ExecDropStmt().
|
static |
Definition at line 3981 of file tablecmds.c.
References AccessExclusiveLock, Assert, CacheInvalidateRelcache(), elog, ereport, errcode(), errmsg(), ERROR, find_all_inheritors(), find_inheritance_children(), forboth, get_domain_constraint_oid(), get_relation_constraint_oid(), GETSTRUCT, HeapTupleIsValid, InvalidOid, lfirst_int, lfirst_oid, NIL, NoLock, ObjectAddressSet, ObjectIdGetDatum(), relation_close(), relation_open(), RelationGetForm, ReleaseSysCache(), renameatt_check(), RenameConstraintById(), RenameRelationInternal(), and SearchSysCache1().
Referenced by RenameConstraint().
ObjectAddress renameatt | ( | RenameStmt * | stmt | ) |
Definition at line 3943 of file tablecmds.c.
References AccessExclusiveLock, attnum, ereport, errmsg(), InvalidObjectAddress, NOTICE, ObjectAddressSubSet, OidIsValid, RangeVarCallbackForRenameAttribute(), RangeVarGetRelidExtended(), renameatt_internal(), RVR_MISSING_OK, and stmt.
Referenced by ExecRenameStmt().
|
static |
Definition at line 3729 of file tablecmds.c.
References aclcheck_error(), ACLCHECK_NOT_OWNER, allowSystemTableMods, ereport, errcode(), errdetail_relkind_not_supported(), errmsg(), ERROR, get_rel_relkind(), get_relkind_objtype(), GetUserId(), IsSystemClass(), NameStr, and object_ownercheck().
Referenced by RangeVarCallbackForRenameAttribute(), rename_constraint_internal(), and renameatt_internal().
|
static |
Definition at line 3778 of file tablecmds.c.
References AccessExclusiveLock, attnum, CatalogTupleUpdate(), check_for_column_name_collision(), ereport, errcode(), errmsg(), ERROR, find_all_inheritors(), find_inheritance_children(), find_typed_table_dependencies(), forboth, GETSTRUCT, heap_freetuple(), HeapTupleIsValid, InvokeObjectPostAlterHook, lfirst_int, lfirst_oid, namestrcpy(), NIL, NoLock, RelationData::rd_rel, relation_close(), relation_open(), RelationGetForm, RelationGetRelationName, renameatt_check(), RowExclusiveLock, SearchSysCacheCopyAttName(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by renameatt().
ObjectAddress RenameConstraint | ( | RenameStmt * | stmt | ) |
Definition at line 4090 of file tablecmds.c.
References AccessExclusiveLock, castNode, checkDomainOwner(), elog, ereport, errmsg(), ERROR, HeapTupleIsValid, InvalidObjectAddress, InvalidOid, makeTypeNameFromNameList(), NoLock, NOTICE, OBJECT_DOMCONSTRAINT, ObjectIdGetDatum(), OidIsValid, RangeVarCallbackForRenameAttribute(), RangeVarGetRelidExtended(), ReleaseSysCache(), rename_constraint_internal(), RowExclusiveLock, RVR_MISSING_OK, SearchSysCache1(), stmt, table_close(), table_open(), and typenameTypeId().
Referenced by ExecRenameStmt().
ObjectAddress RenameRelation | ( | RenameStmt * | stmt | ) |
Definition at line 4140 of file tablecmds.c.
References AccessExclusiveLock, ereport, errmsg(), get_rel_relkind(), InvalidObjectAddress, NOTICE, OBJECT_INDEX, ObjectAddressSet, OidIsValid, RangeVarCallbackForAlterRelation(), RangeVarGetRelidExtended(), RenameRelationInternal(), RVR_MISSING_OK, ShareUpdateExclusiveLock, stmt, and UnlockRelationOid().
Referenced by ExecRenameStmt().
void RenameRelationInternal | ( | Oid | myrelid, |
const char * | newrelname, | ||
bool | is_internal, | ||
bool | is_index | ||
) |
Definition at line 4204 of file tablecmds.c.
References AccessExclusiveLock, Assert, CatalogTupleUpdate(), elog, ereport, errcode(), errmsg(), ERROR, get_index_constraint(), get_relname_relid(), GETSTRUCT, heap_freetuple(), HeapTupleIsValid, InvalidOid, InvokeObjectPostAlterHookArg, namestrcpy(), NoLock, ObjectIdGetDatum(), OidIsValid, RelationData::rd_rel, relation_close(), relation_open(), RelationGetNamespace, RenameConstraintById(), RenameTypeInternal(), RowExclusiveLock, SearchSysCacheCopy1, ShareUpdateExclusiveLock, HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecAddIndexConstraint(), ATExecMergePartitions(), ATExecSplitPartition(), finish_heap_swap(), rename_constraint_internal(), RenameRelation(), and RenameType().
void ResetRelRewrite | ( | Oid | myrelid | ) |
Definition at line 4294 of file tablecmds.c.
References CatalogTupleUpdate(), elog, ERROR, GETSTRUCT, heap_freetuple(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), RowExclusiveLock, SearchSysCacheCopy1, HeapTupleData::t_self, table_close(), and table_open().
Referenced by finish_heap_swap().
|
static |
Definition at line 7733 of file tablecmds.c.
References ATGetQueueEntry(), attnum, CatalogTupleUpdate(), check_stack_depth(), CheckTableNotInUse(), CommandCounterIncrement(), elog, ERROR, find_inheritance_children(), get_attname(), get_attnum(), GETSTRUCT, HeapTupleIsValid, lfirst_oid, NoLock, NotNullImpliedByRelConstraints(), RelationGetRelid, RowExclusiveLock, SearchSysCacheCopyAttNum(), HeapTupleData::t_self, table_close(), table_open(), and AlteredTableInfo::verify_new_notnull.
Referenced by ATAddCheckNNConstraint(), ATExecSetAttNotNull(), ATExecSetNotNull(), AttachPartitionEnsureIndexes(), and DefineRelation().
|
static |
Definition at line 9003 of file tablecmds.c.
References attnum, CatalogTupleUpdate(), GETSTRUCT, heap_freetuple(), HeapTupleIsValid, i, index_close(), index_open(), InvokeObjectPostAlterHook, lfirst_oid, RelationData::rd_index, RelationGetIndexList(), RelationGetRelid, SearchSysCacheCopyAttNum(), and HeapTupleData::t_self.
Referenced by ATExecSetCompression(), and ATExecSetStorage().
Definition at line 3589 of file tablecmds.c.
References CacheInvalidateRelcacheByTuple(), CatalogTupleUpdate(), elog, ERROR, GETSTRUCT, heap_freetuple(), HeapTupleIsValid, ObjectIdGetDatum(), RowExclusiveLock, SearchSysCacheCopy1, HeapTupleData::t_self, table_close(), and table_open().
Referenced by acquire_inherited_sample_rows(), index_create(), IndexSetParentIndex(), and StoreCatalogInheritance1().
void SetRelationTableSpace | ( | Relation | rel, |
Oid | newTableSpaceId, | ||
RelFileNumber | newRelFilenumber | ||
) |
Definition at line 3687 of file tablecmds.c.
References Assert, CatalogTupleUpdate(), changeDependencyOnTablespace(), CheckRelationTableSpaceMove(), elog, ERROR, GETSTRUCT, heap_freetuple(), HeapTupleIsValid, InvalidOid, MyDatabaseTableSpace, ObjectIdGetDatum(), RelationData::rd_rel, RelationGetRelid, RelFileNumberIsValid, RowExclusiveLock, SearchSysCacheCopy1, HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecSetTableSpace(), ATExecSetTableSpaceNoStorage(), and reindex_index().
|
static |
Definition at line 2408 of file tablecmds.c.
Referenced by MergeChildAttribute(), and MergeInheritedAttribute().
|
static |
Definition at line 3470 of file tablecmds.c.
References Assert, lfirst_oid, NIL, OidIsValid, RowExclusiveLock, StoreCatalogInheritance1(), table_close(), and table_open().
Referenced by DefineRelation().
|
static |
Definition at line 3514 of file tablecmds.c.
References child_dependency_type, ObjectAddress::classId, InvokeObjectPostAlterHookArg, ObjectAddress::objectId, ObjectAddress::objectSubId, recordDependencyOn(), SetRelationHasSubclass(), and StoreSingleInheritance().
Referenced by CreateInheritance(), and StoreCatalogInheritance().
|
static |
Definition at line 12190 of file tablecmds.c.
References attname, attnum, ereport, errcode(), errmsg(), ERROR, GETSTRUCT, HeapTupleIsValid, INDEX_MAX_KEYS, lfirst, ReleaseSysCache(), SearchSysCacheAttName(), and strVal.
Referenced by ATAddForeignKeyConstraint().
|
static |
Definition at line 12345 of file tablecmds.c.
References DatumGetPointer(), elog, ereport, errcode(), errmsg(), ERROR, GETSTRUCT, heap_attisnull(), HeapTupleIsValid, i, InvalidOid, j, lfirst_oid, list_free(), ObjectIdGetDatum(), RelationGetIndexList(), RelationGetRelationName, ReleaseSysCache(), SearchSysCache1(), SysCacheGetAttrNotNull(), and oidvector::values.
Referenced by ATAddForeignKeyConstraint().
|
static |
Definition at line 12243 of file tablecmds.c.
References attnumAttName(), attnumTypeId(), DatumGetPointer(), elog, ereport, errcode(), errmsg(), ERROR, GETSTRUCT, HeapTupleIsValid, i, InvalidOid, lappend(), lfirst_oid, list_free(), makeString(), NameStr, NIL, ObjectIdGetDatum(), OidIsValid, pstrdup(), RelationGetIndexList(), RelationGetRelationName, ReleaseSysCache(), SearchSysCache1(), SysCacheGetAttrNotNull(), and oidvector::values.
Referenced by ATAddForeignKeyConstraint().
|
static |
Definition at line 18673 of file tablecmds.c.
References AccessShareLock, addNSItemToQuery(), addRangeTableEntryForRelation(), assign_expr_collations(), copyObject, ereport, errcode(), errmsg(), ERROR, PartitionElem::expr, EXPR_KIND_PARTITION_EXPRESSION, lappend(), lfirst_node, list_length(), PartitionSpec::location, make_parsestate(), makeNode, NIL, PARTITION_STRATEGY_LIST, PartitionSpec::partParams, PartitionSpec::strategy, and transformExpr().
Referenced by DefineRelation().
|
static |
Definition at line 2385 of file tablecmds.c.
References CheckTableNotInUse(), ereport, errcode(), errmsg(), ERROR, and RELATION_IS_OTHER_TEMP.
Referenced by ExecuteTruncate(), and ExecuteTruncateGuts().
|
static |
Definition at line 2367 of file tablecmds.c.
References ACL_TRUNCATE, aclcheck_error(), ACLCHECK_OK, get_relkind_objtype(), GetUserId(), NameStr, pg_class_aclcheck(), and relname.
Referenced by ExecuteTruncateGuts(), and RangeVarCallbackForTruncate().
|
static |
Definition at line 2319 of file tablecmds.c.
References allowSystemTableMods, ereport, errcode(), errmsg(), ERROR, FdwRoutine::ExecForeignTruncate, GetFdwRoutineByServerId(), GetForeignServerIdByRelId(), InvokeObjectTruncateHook, IsBinaryUpgrade, IsSystemClass(), NameStr, and relname.
Referenced by ExecuteTruncate(), ExecuteTruncateGuts(), and RangeVarCallbackForTruncate().
|
static |
Definition at line 11443 of file tablecmds.c.
References Assert, BTEqualStrategyNumber, CommandCounterIncrement(), ForeignKeyCacheInfo::confrelid, ForeignKeyCacheInfo::conoid, ForeignKeyCacheInfo::conrelid, ConstraintSetParentConstraint(), deleteDependencyRecordsFor(), DROP_RESTRICT, elog, ERROR, GetForeignKeyCheckTriggers(), GETSTRUCT, HeapTupleIsValid, i, sort-test::key, ForeignKeyCacheInfo::nkeys, ObjectAddressSet, ObjectIdGetDatum(), OidIsValid, performDeletion(), ReleaseSysCache(), ScanKeyInit(), SearchSysCache1(), systable_beginscan(), systable_endscan(), systable_getnext(), and TriggerSetParentTrigger().
Referenced by addFkRecurseReferencing(), and CloneFkReferencing().
|
static |
Definition at line 14851 of file tablecmds.c.
References ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_HASNULL, ARR_NDIM, Assert, CONSTR_FOREIGN, Constraint::contype, DatumGetArrayTypeP, elog, ERROR, HeapTupleIsValid, i, lappend_oid(), NIL, ObjectIdGetDatum(), Constraint::old_conpfeqop, ReleaseSysCache(), SearchSysCache1(), and SysCacheGetAttrNotNull().
Referenced by ATPostAlterTypeParse().
Definition at line 14822 of file tablecmds.c.
References CheckIndexCompatible(), index_close(), index_open(), NoLock, RelationData::rd_createSubid, RelationData::rd_firstRelfilelocatorSubid, RelationData::rd_locator, RelationData::rd_rel, RelFileLocator::relNumber, and stmt.
Referenced by ATPostAlterTypeParse().
|
static |
Definition at line 10421 of file tablecmds.c.
References ereport, errcode(), errmsg(), ERROR, i, j, list_nth(), and strVal.
Referenced by ATAddForeignKeyConstraint().
|
static |
Definition at line 12554 of file tablecmds.c.
References ALLOCSET_SMALL_SIZES, AllocSetContextCreate, CHECK_FOR_INTERRUPTS, CurrentMemoryContext, DEBUG1, ereport, errmsg_internal(), ExecDropSingleTupleTableSlot(), ExecFetchSlotHeapTuple(), ForwardScanDirection, GetLatestSnapshot(), InvalidOid, LOCAL_FCINFO, MemoryContextDelete(), MemoryContextReset(), MemoryContextSwitchTo(), MemSet, RegisterSnapshot(), RelationGetRelid, RI_FKey_check_ins(), RI_Initial_Check(), SizeForFunctionCallInfo, table_beginscan(), table_endscan(), table_scan_getnextslot(), table_slot_create(), TriggerData::tg_event, TriggerData::tg_relation, TriggerData::tg_trigger, TriggerData::tg_trigslot, TriggerData::tg_trigtuple, Trigger::tgconstraint, Trigger::tgconstrindid, Trigger::tgconstrrelid, Trigger::tgdeferrable, Trigger::tgenabled, Trigger::tginitdeferred, Trigger::tgisinternal, Trigger::tgname, Trigger::tgoid, TRIGGER_EVENT_INSERT, TRIGGER_EVENT_ROW, TRIGGER_FIRES_ON_ORIGIN, TriggerData::type, and UnregisterSnapshot().
Referenced by ATRewriteTables().
Definition at line 20663 of file tablecmds.c.
References AccessExclusiveLock, AccessShareLock, Assert, BTEqualStrategyNumber, CatalogTupleUpdate(), CommandCounterIncrement(), elog, ERROR, get_partition_parent(), GETSTRUCT, heap_freetuple(), HeapTupleIsValid, sort-test::key, ObjectIdGetDatum(), RelationData::rd_index, RelationData::rd_rel, relation_close(), relation_open(), RelationGetPartitionDesc(), RelationGetRelid, ReleaseSysCache(), RowExclusiveLock, ScanKeyInit(), SearchSysCache1(), SearchSysCacheCopy1, systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecAttachPartitionIdx().
Definition at line 20765 of file tablecmds.c.
References ereport, errcode(), errdetail(), errmsg(), ERROR, i, IndexInfo::ii_IndexAttrNumbers, IndexInfo::ii_NumIndexKeyAttrs, NameStr, RelationGetDescr, RelationGetRelationName, and TupleDescAttr.
Referenced by ATExecAttachPartitionIdx().
|
static |
Definition at line 129 of file tablecmds.c.
Referenced by DropErrorMsgNonExistent(), and DropErrorMsgWrongType().
Definition at line 129 of file tablecmds.c.
Referenced by AtEOSubXact_on_commit_actions(), AtEOXact_on_commit_actions(), PreCommit_on_commit_actions(), register_on_commit_action(), and remove_on_commit_action().