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-2018, 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 
25 extern ObjectAddress DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
26  ObjectAddress *typaddress, const char *queryString);
27 
28 extern void RemoveRelations(DropStmt *drop);
29 
30 extern Oid AlterTableLookupRelation(AlterTableStmt *stmt, LOCKMODE lockmode);
31 
32 extern void AlterTable(Oid relid, LOCKMODE lockmode, AlterTableStmt *stmt);
33 
35 
36 extern void ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lockmode);
37 
38 extern void AlterTableInternal(Oid relid, List *cmds, bool recurse);
39 
41 
43  Oid *oldschema);
44 
45 extern void AlterTableNamespaceInternal(Relation rel, Oid oldNspOid,
46  Oid nspOid, ObjectAddresses *objsMoved);
47 
48 extern void AlterRelationNamespaceInternal(Relation classRel, Oid relOid,
49  Oid oldNspOid, Oid newNspOid,
50  bool hasDependEntry,
51  ObjectAddresses *objsMoved);
52 
53 extern void CheckTableNotInUse(Relation rel, const char *stmt);
54 
55 extern void ExecuteTruncate(TruncateStmt *stmt);
56 extern void ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged,
57  DropBehavior behavior, bool restart_seqs);
58 
59 extern void SetRelationHasSubclass(Oid relationId, bool relhassubclass);
60 
61 extern ObjectAddress renameatt(RenameStmt *stmt);
62 
64 
66 
68 
69 extern void RenameRelationInternal(Oid myrelid,
70  const char *newrelname, bool is_internal);
71 
72 extern void find_composite_type_dependencies(Oid typeOid,
73  Relation origRelation,
74  const char *origTypeName);
75 
76 extern void check_of_type(HeapTuple typetuple);
77 
78 extern void createForeignKeyTriggers(Relation rel, Oid refRelOid,
79  Constraint *fkconstraint, Oid constraintOid,
80  Oid indexOid, bool create_action);
81 
83 extern void remove_on_commit_action(Oid relid);
84 
85 extern void PreCommit_on_commit_actions(void);
86 extern void AtEOXact_on_commit_actions(bool isCommit);
87 extern void AtEOSubXact_on_commit_actions(bool isCommit,
88  SubTransactionId mySubid,
89  SubTransactionId parentSubid);
90 
91 extern void RangeVarCallbackOwnsTable(const RangeVar *relation,
92  Oid relId, Oid oldRelId, void *arg);
93 
94 extern void RangeVarCallbackOwnsRelation(const RangeVar *relation,
95  Oid relId, Oid oldRelId, void *noCatalogs);
97  List *partConstraint);
98 
99 #endif /* TABLECMDS_H */
bool PartConstraintImpliedByRelConstraint(Relation scanrel, List *partConstraint)
Definition: tablecmds.c:13866
ObjectAddress renameatt_type(RenameStmt *stmt)
void find_composite_type_dependencies(Oid typeOid, Relation origRelation, const char *origTypeName)
Definition: tablecmds.c:5109
void remove_on_commit_action(Oid relid)
Definition: tablecmds.c:13193
void ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged, DropBehavior behavior, bool restart_seqs)
Definition: tablecmds.c:1411
int LOCKMODE
Definition: lockdefs.h:26
bool relhassubclass
Definition: pg_class.h:63
void AlterTable(Oid relid, LOCKMODE lockmode, AlterTableStmt *stmt)
Definition: tablecmds.c:3290
void AtEOXact_on_commit_actions(bool isCommit)
Definition: tablecmds.c:13287
ObjectAddress RenameRelation(RenameStmt *stmt)
Definition: tablecmds.c:3068
ObjectAddress RenameConstraint(RenameStmt *stmt)
Definition: tablecmds.c:3017
uint32 SubTransactionId
Definition: c.h:478
unsigned int Oid
Definition: postgres_ext.h:31
LOCKMODE AlterTableGetLockLevel(List *cmds)
Definition: tablecmds.c:3359
void SetRelationHasSubclass(Oid relationId, bool relhassubclass)
Definition: tablecmds.c:2633
OnCommitAction
Definition: primnodes.h:48
char relkind
Definition: pg_class.h:51
ObjectAddress AlterTableNamespace(AlterObjectSchemaStmt *stmt, Oid *oldschema)
Definition: tablecmds.c:12853
void RangeVarCallbackOwnsTable(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg)
Definition: tablecmds.c:13374
void createForeignKeyTriggers(Relation rel, Oid refRelOid, Constraint *fkconstraint, Oid constraintOid, Oid indexOid, bool create_action)
Definition: tablecmds.c:8783
void AlterRelationNamespaceInternal(Relation classRel, Oid relOid, Oid oldNspOid, Oid newNspOid, bool hasDependEntry, ObjectAddresses *objsMoved)
Definition: tablecmds.c:12962
void ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lockmode)
Definition: tablecmds.c:10242
void AlterTableNamespaceInternal(Relation rel, Oid oldNspOid, Oid nspOid, ObjectAddresses *objsMoved)
Definition: tablecmds.c:12924
void CheckTableNotInUse(Relation rel, const char *stmt)
Definition: tablecmds.c:3209
void RangeVarCallbackOwnsRelation(const RangeVar *relation, Oid relId, Oid oldRelId, void *noCatalogs)
Definition: tablecmds.c:13407
ObjectAddress DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId, ObjectAddress *typaddress, const char *queryString)
Definition: tablecmds.c:519
DropBehavior
Definition: parsenodes.h:1705
Oid AlterTableLookupRelation(AlterTableStmt *stmt, LOCKMODE lockmode)
Definition: tablecmds.c:3239
void AlterTableInternal(Oid relid, List *cmds, bool recurse)
Definition: tablecmds.c:3314
ObjectAddress renameatt(RenameStmt *stmt)
Definition: tablecmds.c:2880
void check_of_type(HeapTuple typetuple)
Definition: tablecmds.c:5274
Oid AlterTableMoveAll(AlterTableMoveAllStmt *stmt)
Definition: tablecmds.c:11066
void RemoveRelations(DropStmt *drop)
Definition: tablecmds.c:1078
void * arg
void register_on_commit_action(Oid relid, OnCommitAction action)
Definition: tablecmds.c:13162
void AtEOSubXact_on_commit_actions(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid)
Definition: tablecmds.c:13329
Definition: pg_list.h:45
void PreCommit_on_commit_actions(void)
Definition: tablecmds.c:13216
void ExecuteTruncate(TruncateStmt *stmt)
Definition: tablecmds.c:1322
void RenameRelationInternal(Oid myrelid, const char *newrelname, bool is_internal)
Definition: tablecmds.c:3112