PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/attmap.h"
#include "access/genam.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/xact.h"
#include "access/xlog.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_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_namespace.h"
#include "catalog/pg_opclass.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/policy.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 "executor/executor.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_clause.h"
#include "parser/parse_coerce.h"
#include "parser/parse_collate.h"
#include "parser/parse_expr.h"
#include "parser/parse_oper.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/pg_locale.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"
Go to the source code of this file.
Data Structures | |
struct | OnCommitItem |
struct | AlteredTableInfo |
struct | NewConstraint |
struct | NewColumnValue |
struct | dropmsgstrings |
struct | DropRelationCallbackState |
struct | AttachIndexCallbackState |
Macros | |
#define | AT_PASS_UNSET -1 /* UNSET will cause ERROR */ |
#define | AT_PASS_DROP 0 /* DROP (all flavors) */ |
#define | AT_PASS_ALTER_TYPE 1 /* ALTER COLUMN TYPE */ |
#define | AT_PASS_OLD_INDEX 2 /* re-add existing indexes */ |
#define | AT_PASS_OLD_CONSTR 3 /* re-add existing constraints */ |
#define | AT_PASS_ADD_COL 4 /* ADD COLUMN */ |
#define | AT_PASS_ADD_CONSTR 5 /* ADD constraints (initial examination) */ |
#define | AT_PASS_COL_ATTRS 6 /* set column attributes, eg NOT NULL */ |
#define | AT_PASS_ADD_INDEXCONSTR 7 /* ADD index-based constraints */ |
#define | AT_PASS_ADD_INDEX 8 /* ADD indexes */ |
#define | AT_PASS_ADD_OTHERCONSTR 9 /* ADD other constraints, defaults */ |
#define | AT_PASS_MISC 10 /* other stuff */ |
#define | AT_NUM_PASSES 11 |
#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 | child_dependency_type(child_is_partition) ((child_is_partition) ? DEPENDENCY_AUTO : DEPENDENCY_NORMAL) |
Typedefs | |
typedef struct OnCommitItem | OnCommitItem |
typedef struct AlteredTableInfo | AlteredTableInfo |
typedef struct NewConstraint | NewConstraint |
typedef struct NewColumnValue | NewColumnValue |
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 *schema, List *supers, char relpersistence, bool is_partition, List **supconstr) |
static bool | MergeCheckConstraint (List *constraints, char *name, Node *expr) |
static void | MergeAttributesIntoExisting (Relation child_rel, Relation parent_rel) |
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, List *schema) |
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 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) |
static Oid | transformFkeyCheckAttrs (Relation pkrel, int numattrs, int16 *attnums, Oid *opclasses) |
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) |
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, Relation rel, AlterTableCmd *cmd, LOCKMODE lockmode, int cur_pass, AlterTableUtilityContext *context) |
static AlterTableCmd * | ATParseTransformCmd (List **wqueue, AlteredTableInfo *tab, Relation rel, AlterTableCmd *cmd, bool recurse, LOCKMODE lockmode, int 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 (Relation rel, int allowed_targets) |
static void | ATWrongRelkindError (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, int 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 void | ATPrepDropNotNull (Relation rel, bool recurse, bool recursing) |
static ObjectAddress | ATExecDropNotNull (Relation rel, const char *colName, LOCKMODE lockmode) |
static void | ATPrepSetNotNull (List **wqueue, Relation rel, AlterTableCmd *cmd, bool recurse, bool recursing, LOCKMODE lockmode, AlterTableUtilityContext *context) |
static ObjectAddress | ATExecSetNotNull (AlteredTableInfo *tab, Relation rel, const char *colName, LOCKMODE lockmode) |
static void | ATExecCheckNotNull (AlteredTableInfo *tab, 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) |
static ObjectAddress | ATExecSetIdentity (Relation rel, const char *colName, Node *def, LOCKMODE lockmode) |
static ObjectAddress | ATExecDropIdentity (Relation rel, const char *colName, bool missing_ok, 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 ObjectAddress | ATExecAddIndex (AlteredTableInfo *tab, Relation rel, IndexStmt *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 | ATAddCheckConstraint (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, Oid parentConstr, 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, bool old_check_ok) |
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, bool old_check_ok, LOCKMODE lockmode) |
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) |
static void | createForeignKeyActionTriggers (Relation rel, Oid refRelOid, Constraint *fkconstraint, Oid constraintOid, Oid indexOid) |
static bool | tryAttachPartitionForeignKey (ForeignKeyCacheInfo *fk, Oid partRelid, Oid parentConstrOid, int numfks, AttrNumber *mapped_conkey, AttrNumber *confkey, Oid *conpfeqop) |
static void | ATExecDropConstraint (Relation rel, const char *constrName, 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 | RememberConstraintForRebuilding (Oid conoid, AlteredTableInfo *tab) |
static void | RememberIndexForRebuilding (Oid indoid, 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, int 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 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, 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 | ATExecEnableRowSecurity (Relation rel) |
static void | ATExecDisableRowSecurity (Relation rel) |
static void | ATExecForceNoForceRowSecurity (Relation rel, bool force_rls) |
static void | index_copy_data (Relation rel, RelFileNode newrnode) |
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, char *strategy) |
static void | ComputePartitionAttrs (ParseState *pstate, Relation rel, List *partParams, AttrNumber *partattrs, List **partexprs, Oid *partopclass, Oid *partcollation, char strategy) |
static void | CreateInheritance (Relation child_rel, Relation parent_rel) |
static void | RemoveInheritance (Relation child_rel, Relation parent_rel) |
static ObjectAddress | ATExecAttachPartition (List **wqueue, Relation rel, PartitionCmd *cmd, AlterTableUtilityContext *context) |
static void | AttachPartitionEnsureIndexes (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 | DropClonedTriggersFromPartition (Oid partitionId) |
static ObjectAddress | ATExecDetachPartition (Relation rel, RangeVar *name) |
static ObjectAddress | ATExecAttachPartitionIdx (List **wqueue, Relation rel, RangeVar *name) |
static void | validatePartitionedIndex (Relation partedIdx, Relation partedTbl) |
static void | refuseDupeIndexAttach (Relation parentIdx, Relation partIdx, Relation partitionTbl) |
static List * | GetParentedForeignKeyRefs (Relation partition) |
static void | ATDetachCheckNoForeignKeyRefs (Relation partition) |
static void | ATExecAlterCollationRefreshVersion (Relation rel, List *coll) |
ObjectAddress | DefineRelation (CreateStmt *stmt, char relkind, Oid ownerId, ObjectAddress *typaddress, const char *queryString) |
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) |
void | SetRelationHasSubclass (Oid relationId, bool relhassubclass) |
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 | 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) |
void | find_composite_type_dependencies (Oid typeOid, Relation origRelation, const char *origTypeName) |
void | check_of_type (HeapTuple typetuple) |
static void | CreateFKCheckTrigger (Oid myRelOid, Oid refRelOid, Constraint *fkconstraint, Oid constraintOid, Oid indexOid, 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 | 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 | RangeVarCallbackOwnsTable (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 11 |
Definition at line 151 of file tablecmds.c.
Referenced by ATRewriteCatalogs().
#define AT_PASS_ADD_COL 4 /* ADD COLUMN */ |
Definition at line 144 of file tablecmds.c.
Referenced by ATPrepCmd().
#define AT_PASS_ADD_CONSTR 5 /* ADD constraints (initial examination) */ |
Definition at line 145 of file tablecmds.c.
Referenced by ATExecCmd(), and ATPrepCmd().
#define AT_PASS_ADD_INDEX 8 /* ADD indexes */ |
Definition at line 148 of file tablecmds.c.
Referenced by ATParseTransformCmd(), and ATPrepCmd().
#define AT_PASS_ADD_INDEXCONSTR 7 /* ADD index-based constraints */ |
Definition at line 147 of file tablecmds.c.
Referenced by ATParseTransformCmd(), and ATPrepCmd().
#define AT_PASS_ADD_OTHERCONSTR 9 /* ADD other constraints, defaults */ |
Definition at line 149 of file tablecmds.c.
Referenced by ATParseTransformCmd(), and ATPrepCmd().
#define AT_PASS_ALTER_TYPE 1 /* ALTER COLUMN TYPE */ |
Definition at line 140 of file tablecmds.c.
Referenced by ATPrepCmd(), and ATRewriteCatalogs().
#define AT_PASS_COL_ATTRS 6 /* set column attributes, eg NOT NULL */ |
Definition at line 146 of file tablecmds.c.
Referenced by ATParseTransformCmd(), and ATPrepCmd().
#define AT_PASS_DROP 0 /* DROP (all flavors) */ |
Definition at line 139 of file tablecmds.c.
Referenced by ATPrepCmd().
#define AT_PASS_MISC 10 /* other stuff */ |
Definition at line 150 of file tablecmds.c.
Referenced by ATParseTransformCmd(), and ATPrepCmd().
#define AT_PASS_OLD_CONSTR 3 /* re-add existing constraints */ |
Definition at line 142 of file tablecmds.c.
Referenced by ATPostAlterTypeCleanup(), and ATPostAlterTypeParse().
#define AT_PASS_OLD_INDEX 2 /* re-add existing indexes */ |
Definition at line 141 of file tablecmds.c.
Referenced by ATPostAlterTypeParse().
#define AT_PASS_UNSET -1 /* UNSET will cause ERROR */ |
Definition at line 138 of file tablecmds.c.
Referenced by ATPrepCmd().
#define ATT_COMPOSITE_TYPE 0x0010 |
Definition at line 295 of file tablecmds.c.
Referenced by ATPrepCmd(), ATSimplePermissions(), and ATWrongRelkindError().
#define ATT_FOREIGN_TABLE 0x0020 |
Definition at line 296 of file tablecmds.c.
Referenced by ATAddCheckConstraint(), ATExecAddColumn(), ATExecAddInherit(), ATExecAttachPartition(), ATExecDropColumn(), ATExecDropConstraint(), ATPrepCmd(), ATSimplePermissions(), and ATWrongRelkindError().
#define ATT_INDEX 0x0008 |
Definition at line 294 of file tablecmds.c.
Referenced by ATPrepCmd(), ATSimplePermissions(), and ATWrongRelkindError().
#define ATT_MATVIEW 0x0004 |
Definition at line 293 of file tablecmds.c.
Referenced by ATPrepCmd(), ATSimplePermissions(), and ATWrongRelkindError().
#define ATT_PARTITIONED_INDEX 0x0040 |
Definition at line 297 of file tablecmds.c.
Referenced by ATPrepCmd(), and ATSimplePermissions().
#define ATT_TABLE 0x0001 |
Definition at line 291 of file tablecmds.c.
Referenced by ATAddCheckConstraint(), ATExecAddColumn(), ATExecAddInherit(), ATExecAttachPartition(), ATExecDropColumn(), ATExecDropConstraint(), ATPrepCmd(), ATSimplePermissions(), and ATWrongRelkindError().
#define ATT_VIEW 0x0002 |
Definition at line 292 of file tablecmds.c.
Referenced by ATPrepCmd(), ATSimplePermissions(), and ATWrongRelkindError().
#define child_dependency_type | ( | child_is_partition | ) | ((child_is_partition) ? DEPENDENCY_AUTO : DEPENDENCY_NORMAL) |
Definition at line 304 of file tablecmds.c.
Referenced by RemoveInheritance(), and StoreCatalogInheritance1().
typedef struct AlteredTableInfo AlteredTableInfo |
typedef struct NewColumnValue NewColumnValue |
typedef struct NewConstraint NewConstraint |
typedef struct OnCommitItem OnCommitItem |
Definition at line 6538 of file tablecmds.c.
References attnum, ObjectAddress::classId, DEPENDENCY_NORMAL, ObjectAddress::objectId, ObjectAddress::objectSubId, OidIsValid, recordDependencyOn(), and OnCommitItem::relid.
Referenced by ATExecAddColumn(), and ATExecAlterColumnType().
Definition at line 6520 of file tablecmds.c.
References attnum, ObjectAddress::classId, DEPENDENCY_NORMAL, ObjectAddress::objectId, ObjectAddress::objectSubId, recordDependencyOn(), and OnCommitItem::relid.
Referenced by ATExecAddColumn(), and ATExecAlterColumnType().
|
static |
Definition at line 8815 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, 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 9020 of file tablecmds.c.
References AssertArg, ATGetQueueEntry(), AttrMap::attnums, build_attrmap_by_name(), CheckTableNotInUse(), ChooseConstraintName(), ChooseForeignKeyConstraintNameAddition(), CommandCounterIncrement(), NewConstraint::conid, Constraint::conname, CONSTR_FOREIGN, CONSTRAINT_RELATION, ConstraintNameIsUsed(), AlteredTableInfo::constraints, NewConstraint::contype, 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, get_constraint_name(), i, INDEX_MAX_KEYS, Constraint::initdeferred, Constraint::initially_valid, InvalidOid, 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, Constraint::skip_validation, table_close(), table_open(), and tryAttachPartitionForeignKey().
Referenced by ATAddForeignKeyConstraint(), and CloneFkReferencing().
|
static |
Definition at line 15248 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 15178 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, RELOID, SearchSysCacheCopy1, and HeapTupleData::t_self.
Referenced by AlterIndexNamespaces(), AlterSeqNamespaces(), AlterTableNamespaceInternal(), and AlterTypeNamespaceInternal().
|
static |
Definition at line 15293 of file tablecmds.c.
References AccessShareLock, AlterRelationNamespaceInternal(), Assert, BTEqualStrategyNumber, DEPENDENCY_AUTO, DEPENDENCY_INTERNAL, DependReferenceIndexId, GETSTRUCT, HeapTupleIsValid, InvalidOid, sort-test::key, NoLock, ObjectIdGetDatum, relation_close(), relation_open(), RelationGetForm, RelationGetRelid, DropRelationCallbackState::relkind, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), and table_open().
Referenced by AlterTableNamespaceInternal().
void AlterTable | ( | AlterTableStmt * | stmt, |
LOCKMODE | lockmode, | ||
AlterTableUtilityContext * | context | ||
) |
Definition at line 3678 of file tablecmds.c.
References ATController(), CheckTableNotInUse(), AlterTableStmt::cmds, RangeVar::inh, NoLock, AlterTableStmt::relation, relation_open(), and AlterTableUtilityContext::relid.
Referenced by ProcessUtilitySlow().
Definition at line 3752 of file tablecmds.c.
References AccessExclusiveLock, AccessShareLock, AlterTableGetRelOptionsLockLevel(), AT_AddColumn, AT_AddColumnToView, AT_AddConstraint, AT_AddConstraintRecurse, AT_AddIdentity, AT_AddIndex, AT_AddIndexConstraint, AT_AddInherit, AT_AddOf, AT_AlterCollationRefreshVersion, AT_AlterColumnGenericOptions, AT_AlterColumnType, AT_AlterConstraint, AT_AttachPartition, AT_ChangeOwner, AT_CheckNotNull, AT_ClusterOn, AT_ColumnDefault, AT_CookedColumnDefault, AT_DetachPartition, 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_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 3707 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 3622 of file tablecmds.c.
References AlterTableStmt::missing_ok, RangeVarCallbackForAlterRelation(), RangeVarGetRelidExtended(), AlterTableStmt::relation, and RVR_MISSING_OK.
Referenced by ProcessUtilitySlow().
Oid AlterTableMoveAll | ( | AlterTableMoveAllStmt * | stmt | ) |
Definition at line 13372 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, AlterTableMoveAllStmt::new_tablespacename, NIL, NOTICE, AlterTableMoveAllStmt::nowait, OBJECT_INDEX, OBJECT_MATVIEW, OBJECT_TABLE, OBJECT_TABLESPACE, ObjectIdGetDatum, AlterTableMoveAllStmt::objtype, OidIsValid, AlterTableMoveAllStmt::orig_tablespacename, pg_class_ownercheck(), pg_tablespace_aclcheck(), AlterTableMoveAllStmt::roles, roleSpecsToIds(), ScanKeyInit(), AlterTableCmd::subtype, table_beginscan_catalog(), table_close(), table_endscan(), and table_open().
Referenced by ProcessUtilitySlow().
ObjectAddress AlterTableNamespace | ( | AlterObjectSchemaStmt * | stmt, |
Oid * | oldschema | ||
) |
Definition at line 15068 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(), AlterObjectSchemaStmt::missing_ok, new_object_addresses(), NoLock, NOTICE, ObjectAddressSet, OidIsValid, RangeVarCallbackForAlterRelation(), RangeVarGetAndCheckCreationNamespace(), RangeVarGetRelidExtended(), RelationData::rd_rel, AlterObjectSchemaStmt::relation, relation_close(), relation_open(), RelationGetNamespace, RelationGetRelationName, OnCommitItem::relid, RVR_MISSING_OK, and sequenceIsOwned().
Referenced by ExecAlterObjectSchemaStmt().
void AlterTableNamespaceInternal | ( | Relation | rel, |
Oid | oldNspOid, | ||
Oid | nspOid, | ||
ObjectAddresses * | objsMoved | ||
) |
Definition at line 15139 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 8240 of file tablecmds.c.
References AddRelationNewConstraints(), Assert, ATGetQueueEntry(), ATSimplePermissions(), ATT_FOREIGN_TABLE, ATT_TABLE, CheckTableNotInUse(), CommandCounterIncrement(), Constraint::conname, CookedConstraint::conoid, AlteredTableInfo::constraints, CookedConstraint::contype, NewConstraint::contype, copyObject, ereport, errcode(), errmsg(), ERROR, CookedConstraint::expr, find_inheritance_children(), InvalidObjectAddress, Constraint::is_no_inherit, lappend(), lfirst, lfirst_oid, list_length(), list_make1, CookedConstraint::name, NewConstraint::name, NIL, NoLock, ObjectAddressSet, palloc0(), NewConstraint::qual, RelationGetRelid, CookedConstraint::skip_validation, table_close(), and table_open().
Referenced by ATExecAddConstraint().
|
static |
Definition at line 8376 of file tablecmds.c.
References addFkRecurseReferenced(), addFkRecurseReferencing(), allowSystemTableMods, Assert, BTEqualStrategyNumber, can_coerce_type(), checkFkeyPermissions(), CLAOID, COERCION_IMPLICIT, Constraint::conname, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, findFkeyCast(), Constraint::fk_attrs, Constraint::fk_del_action, Constraint::fk_upd_action, FKCONSTR_ACTION_CASCADE, FKCONSTR_ACTION_SETDEFAULT, FKCONSTR_ACTION_SETNULL, format_type_be(), get_opfamily_member(), getBaseType(), GETSTRUCT, HeapTupleIsValid, i, INDEX_MAX_KEYS, Constraint::initially_valid, InvalidOid, IsSystemRelation(), lfirst_oid, list_head(), list_length(), list_nth(), lnext(), MemSet, NIL, NoLock, ObjectAddress::objectId, ObjectIdGetDatum, OidIsValid, Constraint::old_conpfeqop, Constraint::old_pktable_oid, AlteredTableInfo::oldDesc, Constraint::pk_attrs, Constraint::pktable, RelationData::rd_islocaltemp, RelationData::rd_rel, RelationGetDescr, RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), SearchSysCache1(), ShareRowExclusiveLock, Constraint::skip_validation, strVal, table_close(), table_open(), table_openrv(), transformColumnNameList(), transformFkeyCheckAttrs(), transformFkeyGetPrimaryKey(), and TupleDescAttr.
Referenced by ATExecAddConstraint().
Definition at line 5748 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 11267 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 4018 of file tablecmds.c.
References ATPrepCmd(), ATRewriteCatalogs(), ATRewriteTables(), lfirst, NIL, NoLock, and relation_close().
Referenced by AlterTable(), and AlterTableInternal().
|
static |
Definition at line 17581 of file tablecmds.c.
References Assert, CONSTROID, elog, ERROR, GetParentedForeignKeyRefs(), GETSTRUCT, HeapTupleIsValid, InvalidOid, lfirst_oid, MemSet, 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 15569 of file tablecmds.c.
References OnCommitItem::creating_subid, OnCommitItem::deleting_subid, foreach_delete_current, InvalidSubTransactionId, lfirst, and pfree().
Referenced by AbortSubTransaction(), and CommitSubTransaction().
void AtEOXact_on_commit_actions | ( | bool | isCommit | ) |
Definition at line 15537 of file tablecmds.c.
References OnCommitItem::creating_subid, OnCommitItem::deleting_subid, foreach_delete_current, InvalidSubTransactionId, lfirst, and pfree().
Referenced by AbortTransaction(), CommitTransaction(), and PrepareTransaction().
|
static |
Definition at line 6057 of file tablecmds.c.
References ACL_USAGE, aclcheck_error_type(), ACLCHECK_OK, add_column_collation_dependency(), add_column_datatype_dependency(), AddRelationNewConstraints(), TypeName::arrayBounds, Assert, AT_REWRITE_DEFAULT_VAL, ATGetQueueEntry(), ATParseTransformCmd(), ATSimplePermissions(), ATT_FOREIGN_TABLE, ATT_TABLE, RawColumnDefault::attnum, NewColumnValue::attnum, build_column_default(), castNode, CatalogTupleUpdate(), check_for_column_name_collision(), CheckAttributeType(), CheckTableNotInUse(), COERCE_IMPLICIT_CAST, coerce_to_target_type(), COERCION_ASSIGNMENT, ColumnDef::colname, CommandCounterIncrement(), copyObject, CreateTupleDesc(), AlterTableCmd::def, DomainHasConstraints(), elog, ereport, errcode(), errdetail(), errmsg(), ERROR, NewColumnValue::expr, expression_planner(), find_inheritance_children(), FormData_pg_attribute, RawColumnDefault::generated, ColumnDef::generated, get_collation_name(), get_typcollation(), getBaseTypeAndTypmod(), GetColumnDefCollation(), GETSTRUCT, GetUserId(), heap_freetuple(), HeapTupleIsValid, ColumnDef::identity, ColumnDef::identitySequence, ColumnDef::inhcount, InsertPgAttributeTuples(), InvalidObjectAddress, InvokeObjectPostCreateHook, NewColumnValue::is_generated, ColumnDef::is_local, ColumnDef::is_not_null, lappend(), lengthof, lfirst_oid, list_length(), list_make1, list_make1_oid, makeNode, makeNullConst(), MaxHeapAttributeNumber, RawColumnDefault::missingMode, namestrcpy(), newval, AlteredTableInfo::newvals, NIL, NoLock, NOTICE, ObjectAddressSubSet, ObjectIdGetDatum, palloc(), palloc0(), pg_type_aclcheck(), RangeVarGetRelid, RawColumnDefault::raw_default, ColumnDef::raw_default, RelationData::rd_att, RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), DropRelationCallbackState::relkind, RELOID, AlteredTableInfo::rewrite, RowExclusiveLock, SearchSysCacheCopy1, SearchSysCacheCopyAttName(), NextValueExpr::seqid, HeapTupleData::t_self, table_close(), table_open(), TupleDescAttr, NextValueExpr::typeId, ColumnDef::typeName, typenameType(), typenameTypeIdAndMod(), and AlteredTableInfo::verify_new_notnull.
Referenced by ATExecCmd().
|
static |
Definition at line 8125 of file tablecmds.c.
References Assert, ATAddCheckConstraint(), ATAddForeignKeyConstraint(), ChooseConstraintName(), ChooseForeignKeyConstraintNameAddition(), Constraint::conname, CONSTR_CHECK, CONSTR_FOREIGN, CONSTRAINT_RELATION, ConstraintNameIsUsed(), Constraint::contype, elog, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errmsg(), ERROR, Constraint::fk_attrs, InvalidObjectAddress, InvalidOid, IsA, NIL, RelationGetNamespace, RelationGetRelationName, and RelationGetRelid.
Referenced by ATExecCmd().
|
static |
Definition at line 7037 of file tablecmds.c.
References attnum, castNode, CatalogTupleUpdate(), ereport, errcode(), errmsg(), ERROR, GETSTRUCT, heap_freetuple(), HeapTupleIsValid, ColumnDef::identity, InvokeObjectPostAlterHook, ObjectAddressSubSet, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, SearchSysCacheCopyAttName(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by ATExecCmd().
|
static |
Definition at line 7973 of file tablecmds.c.
References Assert, IndexStmt::concurrent, DefineIndex(), index_close(), index_open(), InvalidOid, IsA, NoLock, ObjectAddress::objectId, OidIsValid, IndexStmt::oldCreateSubid, IndexStmt::oldFirstRelfilenodeSubid, IndexStmt::oldNode, RelationData::rd_createSubid, RelationData::rd_firstRelfilenodeSubid, RelationData::rd_node, RelationGetRelid, RelationPreserveStorage(), AlteredTableInfo::rewrite, and IndexStmt::transformed.
Referenced by ATExecCmd().
|
static |
Definition at line 8033 of file tablecmds.c.
References AccessShareLock, allowSystemTableMods, Assert, BuildIndexInfo(), IndexStmt::deferrable, elog, ereport, errcode(), errmsg(), ERROR, IndexStmt::idxname, 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(), IndexStmt::indexOid, IndexStmt::initdeferred, InvalidOid, IsA, IndexStmt::isconstraint, NoLock, NOTICE, OidIsValid, IndexStmt::primary, pstrdup(), RelationData::rd_rel, RelationGetRelationName, and RenameRelationInternal().
Referenced by ATExecCmd().