1 /*-------------------------------------------------------------------------
4 * prototypes for tablecmds.c.
7 * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/commands/tablecmds.h
12 *-------------------------------------------------------------------------
17 #include "access/htup.h"
18 #include "catalog/dependency.h"
19 #include "catalog/objectaddress.h"
20 #include "nodes/parsenodes.h"
21 #include "storage/lock.h"
22 #include "utils/relcache.h"
24 struct AlterTableUtilityContext
; /* avoid including tcop/utility.h here */
27 extern ObjectAddress
DefineRelation(CreateStmt
*stmt
, char relkind
, Oid ownerId
,
28 ObjectAddress
*typaddress
, const char *queryString
);
30 extern void RemoveRelations(DropStmt
*drop
);
32 extern Oid
AlterTableLookupRelation(AlterTableStmt
*stmt
, LOCKMODE lockmode
);
34 extern void AlterTable(AlterTableStmt
*stmt
, LOCKMODE lockmode
,
35 struct AlterTableUtilityContext
*context
);
37 extern LOCKMODE
AlterTableGetLockLevel(List
*cmds
);
39 extern void ATExecChangeOwner(Oid relationOid
, Oid newOwnerId
, bool recursing
, LOCKMODE lockmode
);
41 extern void AlterTableInternal(Oid relid
, List
*cmds
, bool recurse
);
43 extern Oid
AlterTableMoveAll(AlterTableMoveAllStmt
*stmt
);
45 extern ObjectAddress
AlterTableNamespace(AlterObjectSchemaStmt
*stmt
,
48 extern void AlterTableNamespaceInternal(Relation rel
, Oid oldNspOid
,
49 Oid nspOid
, ObjectAddresses
*objsMoved
);
51 extern void AlterRelationNamespaceInternal(Relation classRel
, Oid relOid
,
52 Oid oldNspOid
, Oid newNspOid
,
54 ObjectAddresses
*objsMoved
);
56 extern void CheckTableNotInUse(Relation rel
, const char *stmt
);
58 extern void ExecuteTruncate(TruncateStmt
*stmt
);
59 extern void ExecuteTruncateGuts(List
*explicit_rels
,
62 DropBehavior behavior
,
65 extern void SetRelationHasSubclass(Oid relationId
, bool relhassubclass
);
67 extern bool CheckRelationTableSpaceMove(Relation rel
, Oid newTableSpaceId
);
68 extern void SetRelationTableSpace(Relation rel
, Oid newTableSpaceId
,
71 extern ObjectAddress
renameatt(RenameStmt
*stmt
);
73 extern ObjectAddress
RenameConstraint(RenameStmt
*stmt
);
75 extern ObjectAddress
RenameRelation(RenameStmt
*stmt
);
77 extern void RenameRelationInternal(Oid myrelid
,
78 const char *newrelname
, bool is_internal
,
81 extern void ResetRelRewrite(Oid myrelid
);
83 extern void find_composite_type_dependencies(Oid typeOid
,
84 Relation origRelation
,
85 const char *origTypeName
);
87 extern void check_of_type(HeapTuple typetuple
);
89 extern void register_on_commit_action(Oid relid
, OnCommitAction action
);
90 extern void remove_on_commit_action(Oid relid
);
92 extern void PreCommit_on_commit_actions(void);
93 extern void AtEOXact_on_commit_actions(bool isCommit
);
94 extern void AtEOSubXact_on_commit_actions(bool isCommit
,
95 SubTransactionId mySubid
,
96 SubTransactionId parentSubid
);
98 extern void RangeVarCallbackOwnsTable(const RangeVar
*relation
,
99 Oid relId
, Oid oldRelId
, void *arg
);
101 extern void RangeVarCallbackOwnsRelation(const RangeVar
*relation
,
102 Oid relId
, Oid oldRelId
, void *arg
);
103 extern bool PartConstraintImpliedByRelConstraint(Relation scanrel
,
104 List
*partConstraint
);
106 #endif /* TABLECMDS_H */