| 1 | /*------------------------------------------------------------------------- |
| 2 | * |
| 3 | * tablecmds.h |
| 4 | * prototypes for tablecmds.c. |
| 5 | * |
| 6 | * |
| 7 | * Portions Copyright (c) 1996-2019, 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 | |
| 34 | extern LOCKMODE AlterTableGetLockLevel(List *cmds); |
| 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 | |
| 40 | extern Oid AlterTableMoveAll(AlterTableMoveAllStmt *stmt); |
| 41 | |
| 42 | extern ObjectAddress AlterTableNamespace(AlterObjectSchemaStmt *stmt, |
| 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 | |
| 63 | extern ObjectAddress renameatt_type(RenameStmt *stmt); |
| 64 | |
| 65 | extern ObjectAddress RenameConstraint(RenameStmt *stmt); |
| 66 | |
| 67 | extern ObjectAddress RenameRelation(RenameStmt *stmt); |
| 68 | |
| 69 | extern void RenameRelationInternal(Oid myrelid, |
| 70 | const char *newrelname, bool is_internal, |
| 71 | bool is_index); |
| 72 | |
| 73 | extern void find_composite_type_dependencies(Oid typeOid, |
| 74 | Relation origRelation, |
| 75 | const char *origTypeName); |
| 76 | |
| 77 | extern void check_of_type(HeapTuple typetuple); |
| 78 | |
| 79 | extern void register_on_commit_action(Oid relid, OnCommitAction action); |
| 80 | extern void remove_on_commit_action(Oid relid); |
| 81 | |
| 82 | extern void PreCommit_on_commit_actions(void); |
| 83 | extern void AtEOXact_on_commit_actions(bool isCommit); |
| 84 | extern void AtEOSubXact_on_commit_actions(bool isCommit, |
| 85 | SubTransactionId mySubid, |
| 86 | SubTransactionId parentSubid); |
| 87 | |
| 88 | extern void RangeVarCallbackOwnsTable(const RangeVar *relation, |
| 89 | Oid relId, Oid oldRelId, void *arg); |
| 90 | |
| 91 | extern void RangeVarCallbackOwnsRelation(const RangeVar *relation, |
| 92 | Oid relId, Oid oldRelId, void *noCatalogs); |
| 93 | extern bool PartConstraintImpliedByRelConstraint(Relation scanrel, |
| 94 | List *partConstraint); |
| 95 | |
| 96 | #endif /* TABLECMDS_H */ |
| 97 | |