202
202
const char *acls);
204
204
static void getDependencies(void);
206
static DumpableObject *createBoundaryObjects(void);
207
static void addBoundaryDependencies(DumpableObject **dobjs, int numObjs,
208
DumpableObject *boundaryObjs);
205
210
static void getDomainConstraints(TypeInfo *tyinfo);
206
211
static void getTableData(TableInfo *tblinfo, int numTables, bool oids);
207
212
static void makeTableDataInfo(TableInfo *tbinfo, bool oids);
743
749
getDependencies();
751
/* Lastly, create dummy objects to represent the section boundaries */
752
boundaryObjs = createBoundaryObjects();
754
/* Get pointers to all the known DumpableObjects */
755
getDumpableObjects(&dobjs, &numObjs);
758
* Add dummy dependencies to enforce the dump section ordering.
760
addBoundaryDependencies(dobjs, numObjs, boundaryObjs);
746
763
* Sort the objects into a safe dump order (no forward references).
751
768
* will dump identically. Before 7.3 we don't have dependencies and we
752
769
* use OID ordering as an (unreliable) guide to creation order.
754
getDumpableObjects(&dobjs, &numObjs);
756
771
if (g_fout->remoteVersion >= 70300)
757
772
sortDumpableObjectsByTypeName(dobjs, numObjs);
759
774
sortDumpableObjectsByTypeOid(dobjs, numObjs);
761
sortDumpableObjects(dobjs, numObjs);
776
sortDumpableObjects(dobjs, numObjs,
777
boundaryObjs[0].dumpId, boundaryObjs[1].dumpId);
764
780
* Create archive TOC entries for all the objects to be dumped, in a safe
11578
11598
daclinfo->dobj.namespace ? daclinfo->dobj.namespace->dobj.name : NULL,
11580
11600
daclinfo->defaclrole,
11581
false, "DEFAULT ACL", SECTION_NONE,
11601
false, "DEFAULT ACL", SECTION_POST_DATA,
11582
11602
q->data, "", NULL,
11583
11603
daclinfo->dobj.dependencies, daclinfo->dobj.nDeps,
13984
* createBoundaryObjects - create dummy DumpableObjects to represent
13985
* dump section boundaries.
13987
static DumpableObject *
13988
createBoundaryObjects(void)
13990
DumpableObject *dobjs;
13992
dobjs = (DumpableObject *) pg_malloc(2 * sizeof(DumpableObject));
13994
dobjs[0].objType = DO_PRE_DATA_BOUNDARY;
13995
dobjs[0].catId = nilCatalogId;
13996
AssignDumpId(dobjs + 0);
13997
dobjs[0].name = pg_strdup("PRE-DATA BOUNDARY");
13999
dobjs[1].objType = DO_POST_DATA_BOUNDARY;
14000
dobjs[1].catId = nilCatalogId;
14001
AssignDumpId(dobjs + 1);
14002
dobjs[1].name = pg_strdup("POST-DATA BOUNDARY");
14008
* addBoundaryDependencies - add dependencies as needed to enforce the dump
14009
* section boundaries.
14012
addBoundaryDependencies(DumpableObject **dobjs, int numObjs,
14013
DumpableObject *boundaryObjs)
14015
DumpableObject *preDataBound = boundaryObjs + 0;
14016
DumpableObject *postDataBound = boundaryObjs + 1;
14019
for (i = 0; i < numObjs; i++)
14021
DumpableObject *dobj = dobjs[i];
14024
* The classification of object types here must match the SECTION_xxx
14025
* values assigned during subsequent ArchiveEntry calls!
14027
switch (dobj->objType)
14032
case DO_SHELL_TYPE:
14039
case DO_CONVERSION:
14044
case DO_DUMMY_TYPE:
14047
case DO_TSTEMPLATE:
14050
case DO_FOREIGN_SERVER:
14052
/* Pre-data objects: must come before the pre-data boundary */
14053
addObjectDependency(preDataBound, dobj->dumpId);
14055
case DO_TABLE_DATA:
14057
/* Data objects: must come between the boundaries */
14058
addObjectDependency(dobj, preDataBound->dumpId);
14059
addObjectDependency(postDataBound, dobj->dumpId);
14063
case DO_DEFAULT_ACL:
14064
/* Post-data objects: must come after the post-data boundary */
14065
addObjectDependency(dobj, postDataBound->dumpId);
14068
/* Rules are post-data, but only if dumped separately */
14069
if (((RuleInfo *) dobj)->separate)
14070
addObjectDependency(dobj, postDataBound->dumpId);
14072
case DO_CONSTRAINT:
14073
case DO_FK_CONSTRAINT:
14074
/* Constraints are post-data, but only if dumped separately */
14075
if (((ConstraintInfo *) dobj)->separate)
14076
addObjectDependency(dobj, postDataBound->dumpId);
14078
case DO_PRE_DATA_BOUNDARY:
14079
/* nothing to do */
14081
case DO_POST_DATA_BOUNDARY:
14082
/* must come after the pre-data boundary */
14083
addObjectDependency(dobj, preDataBound->dumpId);
13964
14091
* selectSourceSchema - make the specified schema the active search path
13965
14092
* in the source database.