00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef DEPENDENCY_H
00015 #define DEPENDENCY_H
00016
00017 #include "catalog/objectaddress.h"
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 typedef enum DependencyType
00068 {
00069 DEPENDENCY_NORMAL = 'n',
00070 DEPENDENCY_AUTO = 'a',
00071 DEPENDENCY_INTERNAL = 'i',
00072 DEPENDENCY_EXTENSION = 'e',
00073 DEPENDENCY_PIN = 'p'
00074 } DependencyType;
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 typedef enum SharedDependencyType
00103 {
00104 SHARED_DEPENDENCY_PIN = 'p',
00105 SHARED_DEPENDENCY_OWNER = 'o',
00106 SHARED_DEPENDENCY_ACL = 'a',
00107 SHARED_DEPENDENCY_INVALID = 0
00108 } SharedDependencyType;
00109
00110
00111 typedef struct ObjectAddresses ObjectAddresses;
00112
00113
00114
00115
00116
00117 typedef enum ObjectClass
00118 {
00119 OCLASS_CLASS,
00120 OCLASS_PROC,
00121 OCLASS_TYPE,
00122 OCLASS_CAST,
00123 OCLASS_COLLATION,
00124 OCLASS_CONSTRAINT,
00125 OCLASS_CONVERSION,
00126 OCLASS_DEFAULT,
00127 OCLASS_LANGUAGE,
00128 OCLASS_LARGEOBJECT,
00129 OCLASS_OPERATOR,
00130 OCLASS_OPCLASS,
00131 OCLASS_OPFAMILY,
00132 OCLASS_AMOP,
00133 OCLASS_AMPROC,
00134 OCLASS_REWRITE,
00135 OCLASS_TRIGGER,
00136 OCLASS_SCHEMA,
00137 OCLASS_TSPARSER,
00138 OCLASS_TSDICT,
00139 OCLASS_TSTEMPLATE,
00140 OCLASS_TSCONFIG,
00141 OCLASS_ROLE,
00142 OCLASS_DATABASE,
00143 OCLASS_TBLSPACE,
00144 OCLASS_FDW,
00145 OCLASS_FOREIGN_SERVER,
00146 OCLASS_USER_MAPPING,
00147 OCLASS_DEFACL,
00148 OCLASS_EXTENSION,
00149 OCLASS_EVENT_TRIGGER,
00150 MAX_OCLASS
00151 } ObjectClass;
00152
00153
00154
00155
00156 #define PERFORM_DELETION_INTERNAL 0x0001
00157 #define PERFORM_DELETION_CONCURRENTLY 0x0002
00158
00159 extern void performDeletion(const ObjectAddress *object,
00160 DropBehavior behavior, int flags);
00161
00162 extern void performMultipleDeletions(const ObjectAddresses *objects,
00163 DropBehavior behavior, int flags);
00164
00165 extern void deleteWhatDependsOn(const ObjectAddress *object,
00166 bool showNotices);
00167
00168 extern void recordDependencyOnExpr(const ObjectAddress *depender,
00169 Node *expr, List *rtable,
00170 DependencyType behavior);
00171
00172 extern void recordDependencyOnSingleRelExpr(const ObjectAddress *depender,
00173 Node *expr, Oid relId,
00174 DependencyType behavior,
00175 DependencyType self_behavior);
00176
00177 extern ObjectClass getObjectClass(const ObjectAddress *object);
00178
00179 extern ObjectAddresses *new_object_addresses(void);
00180
00181 extern void add_exact_object_address(const ObjectAddress *object,
00182 ObjectAddresses *addrs);
00183
00184 extern bool object_address_present(const ObjectAddress *object,
00185 const ObjectAddresses *addrs);
00186
00187 extern void record_object_address_dependencies(const ObjectAddress *depender,
00188 ObjectAddresses *referenced,
00189 DependencyType behavior);
00190
00191 extern void free_object_addresses(ObjectAddresses *addrs);
00192
00193
00194
00195 extern void recordDependencyOn(const ObjectAddress *depender,
00196 const ObjectAddress *referenced,
00197 DependencyType behavior);
00198
00199 extern void recordMultipleDependencies(const ObjectAddress *depender,
00200 const ObjectAddress *referenced,
00201 int nreferenced,
00202 DependencyType behavior);
00203
00204 extern void recordDependencyOnCurrentExtension(const ObjectAddress *object,
00205 bool isReplace);
00206
00207 extern long deleteDependencyRecordsFor(Oid classId, Oid objectId,
00208 bool skipExtensionDeps);
00209
00210 extern long deleteDependencyRecordsForClass(Oid classId, Oid objectId,
00211 Oid refclassId, char deptype);
00212
00213 extern long changeDependencyFor(Oid classId, Oid objectId,
00214 Oid refClassId, Oid oldRefObjectId,
00215 Oid newRefObjectId);
00216
00217 extern Oid getExtensionOfObject(Oid classId, Oid objectId);
00218
00219 extern bool sequenceIsOwned(Oid seqId, Oid *tableId, int32 *colId);
00220
00221 extern void markSequenceUnowned(Oid seqId);
00222
00223 extern List *getOwnedSequences(Oid relid);
00224
00225 extern Oid get_constraint_index(Oid constraintId);
00226
00227 extern Oid get_index_constraint(Oid indexId);
00228
00229
00230
00231 extern void recordSharedDependencyOn(ObjectAddress *depender,
00232 ObjectAddress *referenced,
00233 SharedDependencyType deptype);
00234
00235 extern void deleteSharedDependencyRecordsFor(Oid classId, Oid objectId,
00236 int32 objectSubId);
00237
00238 extern void recordDependencyOnOwner(Oid classId, Oid objectId, Oid owner);
00239
00240 extern void changeDependencyOnOwner(Oid classId, Oid objectId,
00241 Oid newOwnerId);
00242
00243 extern void updateAclDependencies(Oid classId, Oid objectId, int32 objectSubId,
00244 Oid ownerId,
00245 int noldmembers, Oid *oldmembers,
00246 int nnewmembers, Oid *newmembers);
00247
00248 extern bool checkSharedDependencies(Oid classId, Oid objectId,
00249 char **detail_msg, char **detail_log_msg);
00250
00251 extern void shdepLockAndCheckObject(Oid classId, Oid objectId);
00252
00253 extern void copyTemplateDependencies(Oid templateDbId, Oid newDbId);
00254
00255 extern void dropDatabaseDependencies(Oid databaseId);
00256
00257 extern void shdepDropOwned(List *relids, DropBehavior behavior);
00258
00259 extern void shdepReassignOwned(List *relids, Oid newrole);
00260
00261 #endif