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:659
#define stmt
Definition: indent_codes.h:59
int LOCKMODE
Definition: lockdefs.h:26
DropBehavior
Definition: parsenodes.h:2329
void * arg
unsigned int Oid
Definition: postgres_ext.h:31
OnCommitAction
Definition: primnodes.h:56
tree context
Definition: radixtree.h:1835
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:4205
ObjectAddress RenameRelation(RenameStmt *stmt)
Definition: tablecmds.c:4048
void AtEOSubXact_on_commit_actions(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid)
Definition: tablecmds.c:17703
void PreCommit_on_commit_actions(void)
Definition: tablecmds.c:17564
void RemoveRelations(DropStmt *drop)
Definition: tablecmds.c:1445
void AlterRelationNamespaceInternal(Relation classRel, Oid relOid, Oid oldNspOid, Oid newNspOid, bool hasDependEntry, ObjectAddresses *objsMoved)
Definition: tablecmds.c:17298
ObjectAddress renameatt(RenameStmt *stmt)
Definition: tablecmds.c:3854
void ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lockmode)
Definition: tablecmds.c:14455
LOCKMODE AlterTableGetLockLevel(List *cmds)
Definition: tablecmds.c:4450
TupleDesc BuildDescForRelation(const List *columns)
Definition: tablecmds.c:1289
void AtEOXact_on_commit_actions(bool isCommit)
Definition: tablecmds.c:17671
void CheckTableNotInUse(Relation rel, const char *stmt)
Definition: tablecmds.c:4258
bool CheckRelationTableSpaceMove(Relation rel, Oid newTableSpaceId)
Definition: tablecmds.c:3538
void find_composite_type_dependencies(Oid typeOid, Relation origRelation, const char *origTypeName)
Definition: tablecmds.c:6736
void AlterTableNamespaceInternal(Relation rel, Oid oldNspOid, Oid nspOid, ObjectAddresses *objsMoved)
Definition: tablecmds.c:17261
void AlterTable(AlterTableStmt *stmt, LOCKMODE lockmode, struct AlterTableUtilityContext *context)
Definition: tablecmds.c:4376
void SetRelationHasSubclass(Oid relationId, bool relhassubclass)
Definition: tablecmds.c:3492
ObjectAddress AlterTableNamespace(AlterObjectSchemaStmt *stmt, Oid *oldschema)
Definition: tablecmds.c:17190
void ExecuteTruncate(TruncateStmt *stmt)
Definition: tablecmds.c:1768
Oid AlterTableLookupRelation(AlterTableStmt *stmt, LOCKMODE lockmode)
Definition: tablecmds.c:4317
void SetRelationTableSpace(Relation rel, Oid newTableSpaceId, RelFileNumber newRelFilenumber)
Definition: tablecmds.c:3595
void remove_on_commit_action(Oid relid)
Definition: tablecmds.c:17541
ObjectAddress DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId, ObjectAddress *typaddress, const char *queryString)
Definition: tablecmds.c:688
void AlterTableInternal(Oid relid, List *cmds, bool recurse)
Definition: tablecmds.c:4405
void check_of_type(HeapTuple typetuple)
Definition: tablecmds.c:6943
Oid AlterTableMoveAll(AlterTableMoveAllStmt *stmt)
Definition: tablecmds.c:15364
void RenameRelationInternal(Oid myrelid, const char *newrelname, bool is_internal, bool is_index)
Definition: tablecmds.c:4112
bool PartConstraintImpliedByRelConstraint(Relation scanrel, List *partConstraint)
Definition: tablecmds.c:18287
void RangeVarCallbackMaintainsTable(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg)
Definition: tablecmds.c:17738
ObjectAddress RenameConstraint(RenameStmt *stmt)
Definition: tablecmds.c:3998
void register_on_commit_action(Oid relid, OnCommitAction action)
Definition: tablecmds.c:17505
void RangeVarCallbackOwnsRelation(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg)
Definition: tablecmds.c:17798
void ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged, DropBehavior behavior, bool restart_seqs, bool run_as_table_owner)
Definition: tablecmds.c:1892