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_publication_rel.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 "common/int.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 |
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 | ATT_PARTITIONED_TABLE 0x0100 |
#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 enum addFkConstraintSides | addFkConstraintSides |
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_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 } |
enum | addFkConstraintSides { addFkReferencedSide , addFkReferencingSide , addFkBothSides } |
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, Oid *attcollids) |
static int | transformFkeyGetPrimaryKey (Relation pkrel, Oid *indexOid, List **attnamelist, int16 *attnums, Oid *atttypids, Oid *attcollids, 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 | CheckAlterTableIsSafe (Relation rel) |
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 void | set_attnotnull (List **wqueue, Relation rel, AttrNumber attnum, LOCKMODE lockmode) |
static ObjectAddress | ATExecSetNotNull (List **wqueue, Relation rel, char *constrname, char *colName, bool recurse, bool recursing, 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, bool recurse, 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 void | validateFkOnDeleteSetColumns (int numfks, const int16 *fkattnums, int numfksetcols, const int16 *fksetcolsattnums, List *fksetcols) |
static ObjectAddress | addFkConstraint (addFkConstraintSides fkside, char *constraintname, 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 is_internal, bool with_period) |
static void | addFkRecurseReferenced (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 | 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, 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 newAccessMethodId) |
static void | ATPrepChangePersistence (AlteredTableInfo *tab, 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 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) |
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 | RangeVarCallbackForAttachIndex (const RangeVar *rv, Oid relOid, Oid oldRelOid, void *arg) |
Variables | |
static List * | on_commits = NIL |
static const struct dropmsgstrings | dropmsgstringarray [] |
#define AT_NUM_PASSES (AT_PASS_MISC + 1) |
Definition at line 166 of file tablecmds.c.
#define ATT_COMPOSITE_TYPE 0x0010 |
Definition at line 332 of file tablecmds.c.
#define ATT_FOREIGN_TABLE 0x0020 |
Definition at line 333 of file tablecmds.c.
#define ATT_INDEX 0x0008 |
Definition at line 331 of file tablecmds.c.
#define ATT_MATVIEW 0x0004 |
Definition at line 330 of file tablecmds.c.
#define ATT_PARTITIONED_INDEX 0x0040 |
Definition at line 334 of file tablecmds.c.
#define ATT_PARTITIONED_TABLE 0x0100 |
Definition at line 336 of file tablecmds.c.
#define ATT_SEQUENCE 0x0080 |
Definition at line 335 of file tablecmds.c.
#define ATT_TABLE 0x0001 |
Definition at line 328 of file tablecmds.c.
#define ATT_VIEW 0x0002 |
Definition at line 329 of file tablecmds.c.
#define child_dependency_type | ( | child_is_partition | ) | ((child_is_partition) ? DEPENDENCY_AUTO : DEPENDENCY_NORMAL) |
Definition at line 365 of file tablecmds.c.
typedef enum addFkConstraintSides addFkConstraintSides |
typedef struct AlteredTableInfo AlteredTableInfo |
typedef enum AlterTablePass AlterTablePass |
typedef struct ForeignTruncateInfo ForeignTruncateInfo |
typedef struct NewColumnValue NewColumnValue |
typedef struct NewConstraint NewConstraint |
typedef struct OnCommitItem OnCommitItem |
enum addFkConstraintSides |
Enumerator | |
---|---|
addFkReferencedSide | |
addFkReferencingSide | |
addFkBothSides |
Definition at line 353 of file tablecmds.c.
enum AlterTablePass |
Definition at line 148 of file tablecmds.c.
Definition at line 7532 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 7514 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 10353 of file tablecmds.c.
References addFkBothSides, addFkReferencedSide, Assert, ChooseConstraintName(), ChooseForeignKeyConstraintNameAddition(), CommandCounterIncrement(), Constraint::conname, CONSTRAINT_RELATION, ConstraintNameIsUsed(), CreateConstraintEntry(), Constraint::deferrable, DEPENDENCY_INTERNAL, 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::initdeferred, Constraint::initially_valid, InvalidOid, NIL, ObjectAddressSet, OidIsValid, pstrdup(), RelationData::rd_rel, recordDependencyOn(), RelationGetNamespace, RelationGetRelationName, and RelationGetRelid.
Referenced by addFkRecurseReferenced(), addFkRecurseReferencing(), ATAddForeignKeyConstraint(), CloneFkReferenced(), and CloneFkReferencing().
|
static |
Definition at line 10528 of file tablecmds.c.
References addFkConstraint(), addFkReferencedSide, Assert, AttrMap::attnums, build_attrmap_by_name_if_req(), CheckRelationLockedByMe(), Constraint::conname, createForeignKeyActionTriggers(), elog, ERROR, free_attrmap(), i, index_get_partition(), j, NoLock, PartitionDescData::nparts, ObjectAddress::objectId, OidIsValid, PartitionDescData::oids, palloc(), pfree(), RelationData::rd_rel, RelationGetDescr, RelationGetPartitionDesc(), RelationGetRelationName, RelationGetRelid, ShareRowExclusiveLock, table_close(), and table_open().
Referenced by ATAddForeignKeyConstraint(), CloneFkReferenced(), and DetachPartitionFinalize().
|
static |
Definition at line 10663 of file tablecmds.c.
References addFkConstraint(), addFkReferencingSide, Assert, ATGetQueueEntry(), AttrMap::attnums, build_attrmap_by_name(), CheckAlterTableIsSafe(), CheckRelationLockedByMe(), NewConstraint::conid, Constraint::conname, CONSTR_FOREIGN, AlteredTableInfo::constraints, NewConstraint::contype, NewConstraint::conwithperiod, copyObject, createForeignKeyCheckTriggers(), ereport, errcode(), errmsg(), ERROR, Constraint::fk_with_period, get_constraint_name(), i, INDEX_MAX_KEYS, j, lappend(), lfirst_node, NewConstraint::name, NoLock, PartitionDescData::nparts, ObjectAddress::objectId, OidIsValid, PartitionDescData::oids, palloc0(), NewConstraint::qual, RelationData::rd_rel, NewConstraint::refindid, NewConstraint::refrelid, RelationGetDescr, RelationGetFKeyList(), RelationGetPartitionDesc(), RelationGetRelid, RowExclusiveLock, ShareRowExclusiveLock, Constraint::skip_validation, table_close(), table_open(), and tryAttachPartitionForeignKey().
Referenced by ATAddForeignKeyConstraint(), and CloneFkReferencing().
|
static |
Definition at line 6444 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_NoForceRowSecurity, AT_ReAddComment, AT_ReAddConstraint, AT_ReAddDomainConstraint, AT_ReAddIndex, AT_ReAddStatistics, AT_ReplaceRelOptions, AT_ReplicaIdentity, AT_ResetOptions, AT_ResetRelOptions, AT_SetAccessMethod, AT_SetCompression, AT_SetExpression, AT_SetIdentity, AT_SetLogged, AT_SetNotNull, AT_SetOptions, AT_SetRelOptions, AT_SetStatistics, AT_SetStorage, AT_SetTableSpace, AT_SetUnLogged, and AT_ValidateConstraint.
Referenced by ATSimplePermissions().
|
static |
Definition at line 17894 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 17817 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, InplaceUpdateTupleLock, InvalidOid, InvokeObjectPostAlterHook, NameStr, object_address_present(), ObjectAddress::objectId, ObjectIdGetDatum(), ObjectAddress::objectSubId, SearchSysCacheLockedCopy1(), HeapTupleData::t_self, and UnlockTuple().
Referenced by AlterIndexNamespaces(), AlterSeqNamespaces(), AlterTableNamespaceInternal(), and AlterTypeNamespaceInternal().
|
static |
Definition at line 17939 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 4447 of file tablecmds.c.
References ATController(), CheckAlterTableIsSafe(), context, NoLock, relation_open(), and stmt.
Referenced by ProcessUtilitySlow().
Definition at line 4521 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_NoForceRowSecurity, AT_ReAddConstraint, AT_ReAddDomainConstraint, AT_ReplaceRelOptions, AT_ReplicaIdentity, AT_ResetOptions, AT_ResetRelOptions, AT_SetAccessMethod, AT_SetCompression, AT_SetExpression, AT_SetIdentity, AT_SetLogged, AT_SetNotNull, AT_SetOptions, AT_SetRelOptions, AT_SetStatistics, AT_SetStorage, AT_SetTableSpace, AT_SetUnLogged, 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 4476 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 4388 of file tablecmds.c.
References RangeVarCallbackForAlterRelation(), RangeVarGetRelidExtended(), RVR_MISSING_OK, and stmt.
Referenced by ProcessUtilitySlow().
Oid AlterTableMoveAll | ( | AlterTableMoveAllStmt * | stmt | ) |
Definition at line 15771 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 17709 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 17780 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 9548 of file tablecmds.c.
References AddRelationNewConstraints(), Assert, AT_AddConstraint, ATGetQueueEntry(), ATSimplePermissions(), ATT_FOREIGN_TABLE, ATT_PARTITIONED_TABLE, ATT_TABLE, CookedConstraint::attnum, check_stack_depth(), CheckAlterTableIsSafe(), 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(), InvalidObjectAddress, 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 9699 of file tablecmds.c.
References addFkBothSides, addFkConstraint(), 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_collation_isdeterministic(), get_collation_name(), 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 6709 of file tablecmds.c.
References CheckAlterTableIsSafe(), 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 13492 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 4783 of file tablecmds.c.
References ATPrepCmd(), ATRewriteCatalogs(), ATRewriteTables(), context, lfirst, NIL, NoLock, and relation_close().
Referenced by AlterTable(), and AlterTableInternal().
|
static |
Definition at line 20692 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 18222 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 18190 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 7065 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_PARTITIONED_TABLE, ATT_TABLE, RawColumnDefault::attnum, build_column_default(), BuildDescForRelation(), castNode, CatalogTupleUpdate(), check_for_column_name_collision(), check_stack_depth(), CheckAlterTableIsSafe(), CheckAttributeType(), 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(), pg_add_s16_overflow(), 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 9432 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 8034 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 9256 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 9340 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 16047 of file tablecmds.c.