PostgreSQL Source Code  git master
tablecmds.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * tablecmds.h
4  * prototypes for tablecmds.c.
5  *
6  *
7  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/commands/tablecmds.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef TABLECMDS_H
15 #define TABLECMDS_H
16 
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"
23 
24 struct AlterTableUtilityContext; /* avoid including tcop/utility.h here */
25 
26 
27 extern ObjectAddress DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
28  ObjectAddress *typaddress, const char *queryString);
29 
30 extern TupleDesc BuildDescForRelation(const List *columns);
31 
32 extern void RemoveRelations(DropStmt *drop);
33 
35 
36 extern void AlterTable(AlterTableStmt *stmt, LOCKMODE lockmode,
38 
40 
41 extern void ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lockmode);
42 
43 extern void AlterTableInternal(Oid relid, List *cmds, bool recurse);
44 
46 
48  Oid *oldschema);
49 
50 extern void AlterTableNamespaceInternal(Relation rel, Oid oldNspOid,
51  Oid nspOid, ObjectAddresses *objsMoved);
52 
53 extern void AlterRelationNamespaceInternal(Relation classRel, Oid relOid,
54  Oid oldNspOid, Oid newNspOid,
55  bool hasDependEntry,
56  ObjectAddresses *objsMoved);
57 
58 extern void CheckTableNotInUse(Relation rel, const char *stmt);
59 
60 extern void ExecuteTruncate(TruncateStmt *stmt);
61 extern void ExecuteTruncateGuts(List *explicit_rels,
62  List *relids,
63  List *relids_logged,
64  DropBehavior behavior,
65  bool restart_seqs,
66  bool run_as_table_owner);
67 
68 extern void SetRelationHasSubclass(Oid relationId, bool relhassubclass);
69 
70 extern bool CheckRelationTableSpaceMove(Relation rel, Oid newTableSpaceId);
71 extern void SetRelationTableSpace(Relation rel, Oid newTableSpaceId,
72  RelFileNumber newRelFilenumber);
73 
75 
77 
79 
80 extern void RenameRelationInternal(Oid myrelid,
81  const char *newrelname, bool is_internal,
82  bool is_index);
83 
84 extern void ResetRelRewrite(Oid myrelid);
85 
86 extern void find_composite_type_dependencies(Oid typeOid,
87  Relation origRelation,
88  const char *origTypeName);
89 
90 extern void check_of_type(HeapTuple typetuple);
91 
93 extern void remove_on_commit_action(Oid relid);
94 
95 extern void PreCommit_on_commit_actions(void);
96 extern void AtEOXact_on_commit_actions(bool isCommit);
97 extern void AtEOSubXact_on_commit_actions(bool isCommit,
98  SubTransactionId mySubid,
99  SubTransactionId parentSubid);
100 
101 extern void RangeVarCallbackMaintainsTable(const RangeVar *relation,
102  Oid relId, Oid oldRelId,
103  void *arg);
104 
105 extern void RangeVarCallbackOwnsRelation(const RangeVar *relation,
106  Oid relId, Oid oldRelId, void *arg);
108  List *partConstraint);
109 
110 #endif /* TABLECMDS_H */
uint32 SubTransactionId
Definition: c.h:656
#define stmt
Definition: indent_codes.h:59
int LOCKMODE
Definition: lockdefs.h:26
DropBehavior
Definition: parsenodes.h:2333
void * arg
unsigned int Oid
Definition: postgres_ext.h:31
OnCommitAction
Definition: primnodes.h:56
tree context
Definition: radixtree.h:1833
Oid RelFileNumber
Definition: relpath.h:25
const char * queryString
Definition: utility.h:33
Definition: pg_list.h:54
void ResetRelRewrite(Oid myrelid)
Definition: tablecmds.c:4197
ObjectAddress RenameRelation(RenameStmt *stmt)
Definition: tablecmds.c:4043
void AtEOSubXact_on_commit_actions(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid)
Definition: tablecmds.c:17515
void PreCommit_on_commit_actions(void)
Definition: tablecmds.c:17376
void RemoveRelations(DropStmt *drop)
Definition: tablecmds.c:1455
void AlterRelationNamespaceInternal(Relation classRel, Oid relOid, Oid oldNspOid, Oid newNspOid, bool hasDependEntry, ObjectAddresses *objsMoved)
Definition: tablecmds.c:17117
ObjectAddress renameatt(RenameStmt *stmt)
Definition: tablecmds.c:3849
void ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lockmode)
Definition: tablecmds.c:14279
LOCKMODE AlterTableGetLockLevel(List *cmds)
Definition: tablecmds.c:4411
TupleDesc BuildDescForRelation(const List *columns)
Definition: tablecmds.c:1278
void AtEOXact_on_commit_actions(bool isCommit)
Definition: tablecmds.c:17483
void CheckTableNotInUse(Relation rel, const char *stmt)
Definition: tablecmds.c:4250
bool CheckRelationTableSpaceMove(Relation rel, Oid newTableSpaceId)
Definition: tablecmds.c:3536
void find_composite_type_dependencies(Oid typeOid, Relation origRelation, const char *origTypeName)
Definition: tablecmds.c:6712
void AlterTableNamespaceInternal(Relation rel, Oid oldNspOid, Oid nspOid, ObjectAddresses *objsMoved)
Definition: tablecmds.c:17080
void AlterTable(AlterTableStmt *stmt, LOCKMODE lockmode, struct AlterTableUtilityContext *context)
Definition: tablecmds.c:4337
void SetRelationHasSubclass(Oid relationId, bool relhassubclass)
Definition: tablecmds.c:3495
ObjectAddress AlterTableNamespace(AlterObjectSchemaStmt *stmt, Oid *oldschema)
Definition: tablecmds.c:17009
void ExecuteTruncate(TruncateStmt *stmt)
Definition: tablecmds.c:1778
Oid AlterTableLookupRelation(AlterTableStmt *stmt, LOCKMODE lockmode)
Definition: tablecmds.c:4278
void SetRelationTableSpace(Relation rel, Oid newTableSpaceId, RelFileNumber newRelFilenumber)
Definition: tablecmds.c:3593
void remove_on_commit_action(Oid relid)
Definition: tablecmds.c:17353
ObjectAddress DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId, ObjectAddress *typaddress, const char *queryString)
Definition: tablecmds.c:685
void AlterTableInternal(Oid relid, List *cmds, bool recurse)
Definition: tablecmds.c:4366
void check_of_type(HeapTuple typetuple)
Definition: tablecmds.c:6919
Oid AlterTableMoveAll(AlterTableMoveAllStmt *stmt)
Definition: tablecmds.c:15187
void RenameRelationInternal(Oid myrelid, const char *newrelname, bool is_internal, bool is_index)
Definition: tablecmds.c:4107
bool PartConstraintImpliedByRelConstraint(Relation scanrel, List *partConstraint)
Definition: tablecmds.c:18099
void RangeVarCallbackMaintainsTable(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg)
Definition: tablecmds.c:17550
ObjectAddress RenameConstraint(RenameStmt *stmt)
Definition: tablecmds.c:3993
void register_on_commit_action(Oid relid, OnCommitAction action)
Definition: tablecmds.c:17317
void RangeVarCallbackOwnsRelation(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg)
Definition: tablecmds.c:17610
void ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged, DropBehavior behavior, bool restart_seqs, bool run_as_table_owner)
Definition: tablecmds.c:1902