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-2023, 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 void RemoveRelations(DropStmt *drop);
31 
32 extern Oid AlterTableLookupRelation(AlterTableStmt *stmt, LOCKMODE lockmode);
33 
34 extern void AlterTable(AlterTableStmt *stmt, LOCKMODE lockmode,
35  struct AlterTableUtilityContext *context);
36 
38 
39 extern void ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lockmode);
40 
41 extern void AlterTableInternal(Oid relid, List *cmds, bool recurse);
42 
44 
46  Oid *oldschema);
47 
48 extern void AlterTableNamespaceInternal(Relation rel, Oid oldNspOid,
49  Oid nspOid, ObjectAddresses *objsMoved);
50 
51 extern void AlterRelationNamespaceInternal(Relation classRel, Oid relOid,
52  Oid oldNspOid, Oid newNspOid,
53  bool hasDependEntry,
54  ObjectAddresses *objsMoved);
55 
56 extern void CheckTableNotInUse(Relation rel, const char *stmt);
57 
58 extern void ExecuteTruncate(TruncateStmt *stmt);
59 extern void ExecuteTruncateGuts(List *explicit_rels,
60  List *relids,
61  List *relids_logged,
62  DropBehavior behavior,
63  bool restart_seqs);
64 
65 extern void SetRelationHasSubclass(Oid relationId, bool relhassubclass);
66 
67 extern bool CheckRelationTableSpaceMove(Relation rel, Oid newTableSpaceId);
68 extern void SetRelationTableSpace(Relation rel, Oid newTableSpaceId,
69  RelFileNumber newRelFilenumber);
70 
71 extern ObjectAddress renameatt(RenameStmt *stmt);
72 
74 
76 
77 extern void RenameRelationInternal(Oid myrelid,
78  const char *newrelname, bool is_internal,
79  bool is_index);
80 
81 extern void ResetRelRewrite(Oid myrelid);
82 
83 extern void find_composite_type_dependencies(Oid typeOid,
84  Relation origRelation,
85  const char *origTypeName);
86 
87 extern void check_of_type(HeapTuple typetuple);
88 
90 extern void remove_on_commit_action(Oid relid);
91 
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);
97 
98 extern void RangeVarCallbackMaintainsTable(const RangeVar *relation,
99  Oid relId, Oid oldRelId,
100  void *arg);
101 extern bool has_partition_ancestor_privs(Oid relid, Oid userid, AclMode acl);
102 
103 extern void RangeVarCallbackOwnsRelation(const RangeVar *relation,
104  Oid relId, Oid oldRelId, void *arg);
106  List *partConstraint);
107 
108 #endif /* TABLECMDS_H */
uint32 SubTransactionId
Definition: c.h:640
int LOCKMODE
Definition: lockdefs.h:26
uint64 AclMode
Definition: parsenodes.h:81
DropBehavior
Definition: parsenodes.h:2015
void * arg
unsigned int Oid
Definition: postgres_ext.h:31
OnCommitAction
Definition: primnodes.h:48
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:3965
ObjectAddress RenameRelation(RenameStmt *stmt)
Definition: tablecmds.c:3811
void AtEOSubXact_on_commit_actions(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid)
Definition: tablecmds.c:16810
void PreCommit_on_commit_actions(void)
Definition: tablecmds.c:16679
void RemoveRelations(DropStmt *drop)
Definition: tablecmds.c:1342
bool has_partition_ancestor_privs(Oid relid, Oid userid, AclMode acl)
Definition: tablecmds.c:16880
void AlterRelationNamespaceInternal(Relation classRel, Oid relOid, Oid oldNspOid, Oid newNspOid, bool hasDependEntry, ObjectAddresses *objsMoved)
Definition: tablecmds.c:16420
ObjectAddress renameatt(RenameStmt *stmt)
Definition: tablecmds.c:3617
void ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lockmode)
Definition: tablecmds.c:13686
LOCKMODE AlterTableGetLockLevel(List *cmds)
Definition: tablecmds.c:4179
void AtEOXact_on_commit_actions(bool isCommit)
Definition: tablecmds.c:16778
void CheckTableNotInUse(Relation rel, const char *stmt)
Definition: tablecmds.c:4018
bool CheckRelationTableSpaceMove(Relation rel, Oid newTableSpaceId)
Definition: tablecmds.c:3304
void find_composite_type_dependencies(Oid typeOid, Relation origRelation, const char *origTypeName)
Definition: tablecmds.c:6424
void AlterTableNamespaceInternal(Relation rel, Oid oldNspOid, Oid nspOid, ObjectAddresses *objsMoved)
Definition: tablecmds.c:16381
void AlterTable(AlterTableStmt *stmt, LOCKMODE lockmode, struct AlterTableUtilityContext *context)
Definition: tablecmds.c:4105
void SetRelationHasSubclass(Oid relationId, bool relhassubclass)
Definition: tablecmds.c:3263
ObjectAddress AlterTableNamespace(AlterObjectSchemaStmt *stmt, Oid *oldschema)
Definition: tablecmds.c:16310
void ExecuteTruncate(TruncateStmt *stmt)
Definition: tablecmds.c:1665
void ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged, DropBehavior behavior, bool restart_seqs)
Definition: tablecmds.c:1789
Oid AlterTableLookupRelation(AlterTableStmt *stmt, LOCKMODE lockmode)
Definition: tablecmds.c:4046
void SetRelationTableSpace(Relation rel, Oid newTableSpaceId, RelFileNumber newRelFilenumber)
Definition: tablecmds.c:3361
void remove_on_commit_action(Oid relid)
Definition: tablecmds.c:16656
ObjectAddress DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId, ObjectAddress *typaddress, const char *queryString)
Definition: tablecmds.c:662
void AlterTableInternal(Oid relid, List *cmds, bool recurse)
Definition: tablecmds.c:4134
void check_of_type(HeapTuple typetuple)
Definition: tablecmds.c:6591
Oid AlterTableMoveAll(AlterTableMoveAllStmt *stmt)
Definition: tablecmds.c:14487
void RenameRelationInternal(Oid myrelid, const char *newrelname, bool is_internal, bool is_index)
Definition: tablecmds.c:3875
bool PartConstraintImpliedByRelConstraint(Relation scanrel, List *partConstraint)
Definition: tablecmds.c:17412
void RangeVarCallbackMaintainsTable(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg)
Definition: tablecmds.c:16845
ObjectAddress RenameConstraint(RenameStmt *stmt)
Definition: tablecmds.c:3761
void register_on_commit_action(Oid relid, OnCommitAction action)
Definition: tablecmds.c:16620
void RangeVarCallbackOwnsRelation(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg)
Definition: tablecmds.c:16929