/* Sort by publication name, since (namespace, name) match the rel */
cmpval = strcmp(probj1->publication->dobj.name,
probj2->publication->dobj.name); if (cmpval != 0) return cmpval;
} elseif (obj1->objType == DO_PUBLICATION_TABLE_IN_SCHEMA)
{
PublicationSchemaInfo *psobj1 = *(PublicationSchemaInfo *const *) p1;
PublicationSchemaInfo *psobj2 = *(PublicationSchemaInfo *const *) p2;
/* Sort by publication name, since ->name is just nspname */
cmpval = strcmp(psobj1->publication->dobj.name,
psobj2->publication->dobj.name); if (cmpval != 0) return cmpval;
} elseif (obj1->objType == DO_SUBSCRIPTION_REL)
{
SubRelInfo *srobj1 = *(SubRelInfo *const *) p1;
SubRelInfo *srobj2 = *(SubRelInfo *const *) p2;
/* Sort by subscription name, since (namespace, name) match the rel */
cmpval = strcmp(srobj1->subinfo->dobj.name,
srobj2->subinfo->dobj.name); if (cmpval != 0) return cmpval;
}
/* Compare two OID-identified pg_type values by nspname, then by typname. */ staticint
pgTypeNameCompare(Oid typid1, Oid typid2)
{
TypeInfo *typobj1;
TypeInfo *typobj2; int cmpval;
/* *Seeifwe'vefoundaloopbacktothedesiredstartPoint;ifso,done
*/ for (i = 0; i < obj->nDeps; i++)
{ if (obj->dependencies[i] == startPoint) return depth;
}
/* *Recursedowneachoutgoingbranch
*/ for (i = 0; i < obj->nDeps; i++)
{
DumpableObject *nextobj = findObjectByDumpId(obj->dependencies[i]); int newDepth;
if (!nextobj) continue; /* ignore dependencies on undumped objects */
newDepth = findLoop(nextobj,
startPoint,
processed,
searchFailed,
workspace,
depth); if (newDepth > 0) return newDepth;
}
/* *BecauseweforceaviewtodependonitsONSELECTrule,whilethere *willbeanimplicitdependencyintheotherdirection,weneedtobreak *theloop.Iftherearenootherobjectsintheloopthenwecanremove *theimplicitdependencyandleavetheONSELECTrulenon-separate. *Thisappliestomatviews,aswell.
*/ staticvoid
repairViewRuleLoop(DumpableObject *viewobj,
DumpableObject *ruleobj)
{ /* remove rule's dependency on view */
removeObjectDependency(ruleobj, viewobj->dumpId); /* flags on the two objects are already set correctly for this case */
}
/* remove view's dependency on rule */
removeObjectDependency(viewobj, ruleobj->dumpId); /* mark view to be printed with a dummy definition */
viewinfo->dummy_view = true; /* mark rule as needing its own dump */
ruleinfo->separate = true; /* put back rule's dependency on view */
addObjectDependency(ruleobj, viewobj->dumpId); /* now that rule is separate, it must be post-data */
addObjectDependency(ruleobj, postDataBoundId);
}
/* *Ifamatviewisinvolvedinamulti-objectloop,wecan'tcurrentlyfix *thatbysplittingofftherule.Asastopgap,wetrytofixitby *droppingtheconstraintthatthematviewbedumpedinthepre-datasection. *Thisissufficienttohandlecaseswhereamatviewdependsonsomeunique *index,ascanhappenifithasaGROUPBYforexample. * *Notethatthe"nextobject"isnotnecessarilythematviewitself; *itcouldbethematview'srowtype,forexample.Wemaycomethroughhere *severaltimeswhileremovingallthepre-datalinkages.Inparticular, *ifthereareothermatviewsthatdependontheonewiththecircularity *problem,we'llcomethroughhereforeachsuchmatviewandmarkthemall *aspostponed.(ThisworksbecauseallMVshavepre-datadependencies *tobeginwith,soeachofthemwillgetvisited.)
*/ staticvoid
repairMatViewBoundaryMultiLoop(DumpableObject *boundaryobj,
DumpableObject *nextobj)
{ /* remove boundary's dependency on object after it in loop */
removeObjectDependency(boundaryobj, nextobj->dumpId);
if (nextinfo->relkind == RELKIND_MATVIEW)
nextinfo->section = SECTION_POST_DATA;
}
}
/* *Ifafunctionisinvolvedinamulti-objectloop,wecan'tcurrentlyfix *thatbysplittingitintotwoDumpableObjects.Asastopgap,wetrytofix *itbydroppingtheconstraintthatthefunctionbedumpedinthepre-data *section.Thisissufficienttohandlecaseswhereafunctiondependson *someuniqueindex,ascanhappenifithasaGROUPBYforexample.
*/ staticvoid
repairFunctionBoundaryMultiLoop(DumpableObject *boundaryobj,
DumpableObject *nextobj)
{ /* remove boundary's dependency on object after it in loop */
removeObjectDependency(boundaryobj, nextobj->dumpId); /* if that object is a function, mark it as postponed into post-data */ if (nextobj->objType == DO_FUNC)
{
FuncInfo *nextinfo = (FuncInfo *) nextobj;
/* *However,ifthereareotherobjectsintheloop,wemustbreaktheloop *bymakingtheCHECKconstraintaseparately-dumpedobject. * *BecausefindLoop()findsshortercyclesbeforelongerones,it'slikely *thatwewillhavepreviouslyfiredrepairTableConstraintLoop()and *removedtheconstraint'sdependencyonthetable.Putitbacktoensure *theconstraintwon'tbeemittedbeforethetable...
*/ staticvoid
repairTableConstraintMultiLoop(DumpableObject *tableobj,
DumpableObject *constraintobj)
{ /* remove table's dependency on constraint */
removeObjectDependency(tableobj, constraintobj->dumpId); /* mark constraint as needing its own dump */
((ConstraintInfo *) constraintobj)->separate = true; /* put back constraint's dependency on table */
addObjectDependency(constraintobj, tableobj->dumpId); /* now that constraint is separate, it must be post-data */
addObjectDependency(constraintobj, postDataBoundId);
}
staticvoid
repairTableAttrDefMultiLoop(DumpableObject *tableobj,
DumpableObject *attrdefobj)
{ /* remove table's dependency on attrdef */
removeObjectDependency(tableobj, attrdefobj->dumpId); /* mark attrdef as needing its own dump */
((AttrDefInfo *) attrdefobj)->separate = true; /* put back attrdef's dependency on table */
addObjectDependency(attrdefobj, tableobj->dumpId);
}
staticvoid
repairDomainConstraintMultiLoop(DumpableObject *domainobj,
DumpableObject *constraintobj)
{ /* remove domain's dependency on constraint */
removeObjectDependency(domainobj, constraintobj->dumpId); /* mark constraint as needing its own dump */
((ConstraintInfo *) constraintobj)->separate = true; /* put back constraint's dependency on domain */
addObjectDependency(constraintobj, domainobj->dumpId); /* now that constraint is separate, it must be post-data */
addObjectDependency(constraintobj, postDataBoundId);
}
/* Indirect loop involving function and data boundary */ if (nLoop > 2)
{ for (i = 0; i < nLoop; i++)
{ if (loop[i]->objType == DO_FUNC)
{ for (j = 0; j < nLoop; j++)
{ if (loop[j]->objType == DO_PRE_DATA_BOUNDARY)
{
DumpableObject *nextobj;
/* *IfalltheobjectsareTABLE_DATAitems,whatwemusthaveisa *circularsetofforeignkeyconstraints(orasingleself-referential *table).Printanappropriatecomplaintandbreakthelooparbitrarily.
*/ for (i = 0; i < nLoop; i++)
{ if (loop[i]->objType != DO_TABLE_DATA) break;
} if (i >= nLoop)
{
pg_log_warning(ngettext("there are circular foreign-key constraints on this table:", "there are circular foreign-key constraints among these tables:",
nLoop)); for (i = 0; i < nLoop; i++)
pg_log_warning_detail("%s", loop[i]->name);
pg_log_warning_hint("You might not be able to restore the dump without using --disable-triggers or temporarily dropping the constraints.");
pg_log_warning_hint("Consider using a full dump instead of a --data-only dump to avoid this problem."); if (nLoop > 1)
removeObjectDependency(loop[0], loop[1]->dumpId); else/* must be a self-dependency */
removeObjectDependency(loop[0], loop[0]->dumpId); return;
}
/* *Ifwecan'tfindaprincipledwaytobreaktheloop,complainandbreak *itinanarbitraryfashion.
*/
pg_log_warning("could not resolve dependency loop among these items:"); for (i = 0; i < nLoop; i++)
{ char buf[1024];
if (nLoop > 1)
removeObjectDependency(loop[0], loop[1]->dumpId); else/* must be a self-dependency */
removeObjectDependency(loop[0], loop[0]->dumpId);
}
/* *Describeadumpableobjectusefullyforerrors * *Thisshouldprobablygosomewhereelse...
*/ staticvoid
describeDumpableObject(DumpableObject *obj, char *buf, int bufsize)
{ switch (obj->objType)
{ case DO_NAMESPACE:
snprintf(buf, bufsize, "SCHEMA %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_EXTENSION:
snprintf(buf, bufsize, "EXTENSION %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_TYPE:
snprintf(buf, bufsize, "TYPE %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_SHELL_TYPE:
snprintf(buf, bufsize, "SHELL TYPE %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_FUNC:
snprintf(buf, bufsize, "FUNCTION %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_AGG:
snprintf(buf, bufsize, "AGGREGATE %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_OPERATOR:
snprintf(buf, bufsize, "OPERATOR %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_ACCESS_METHOD:
snprintf(buf, bufsize, "ACCESS METHOD %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_OPCLASS:
snprintf(buf, bufsize, "OPERATOR CLASS %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_OPFAMILY:
snprintf(buf, bufsize, "OPERATOR FAMILY %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_COLLATION:
snprintf(buf, bufsize, "COLLATION %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_CONVERSION:
snprintf(buf, bufsize, "CONVERSION %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_TABLE:
snprintf(buf, bufsize, "TABLE %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_TABLE_ATTACH:
snprintf(buf, bufsize, "TABLE ATTACH %s (ID %d)",
obj->name, obj->dumpId); return; case DO_ATTRDEF:
snprintf(buf, bufsize, "ATTRDEF %s.%s (ID %d OID %u)",
((AttrDefInfo *) obj)->adtable->dobj.name,
((AttrDefInfo *) obj)->adtable->attnames[((AttrDefInfo *) obj)->adnum - 1],
obj->dumpId, obj->catId.oid); return; case DO_INDEX:
snprintf(buf, bufsize, "INDEX %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_INDEX_ATTACH:
snprintf(buf, bufsize, "INDEX ATTACH %s (ID %d)",
obj->name, obj->dumpId); return; case DO_STATSEXT:
snprintf(buf, bufsize, "STATISTICS %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_REFRESH_MATVIEW:
snprintf(buf, bufsize, "REFRESH MATERIALIZED VIEW %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_RULE:
snprintf(buf, bufsize, "RULE %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_TRIGGER:
snprintf(buf, bufsize, "TRIGGER %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_EVENT_TRIGGER:
snprintf(buf, bufsize, "EVENT TRIGGER %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_CONSTRAINT:
snprintf(buf, bufsize, "CONSTRAINT %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_FK_CONSTRAINT:
snprintf(buf, bufsize, "FK CONSTRAINT %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_PROCLANG:
snprintf(buf, bufsize, "PROCEDURAL LANGUAGE %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_CAST:
snprintf(buf, bufsize, "CAST %u to %u (ID %d OID %u)",
((CastInfo *) obj)->castsource,
((CastInfo *) obj)->casttarget,
obj->dumpId, obj->catId.oid); return; case DO_TRANSFORM:
snprintf(buf, bufsize, "TRANSFORM %u lang %u (ID %d OID %u)",
((TransformInfo *) obj)->trftype,
((TransformInfo *) obj)->trflang,
obj->dumpId, obj->catId.oid); return; case DO_TABLE_DATA:
snprintf(buf, bufsize, "TABLE DATA %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_SEQUENCE_SET:
snprintf(buf, bufsize, "SEQUENCE SET %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_DUMMY_TYPE:
snprintf(buf, bufsize, "DUMMY TYPE %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_TSPARSER:
snprintf(buf, bufsize, "TEXT SEARCH PARSER %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_TSDICT:
snprintf(buf, bufsize, "TEXT SEARCH DICTIONARY %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_TSTEMPLATE:
snprintf(buf, bufsize, "TEXT SEARCH TEMPLATE %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_TSCONFIG:
snprintf(buf, bufsize, "TEXT SEARCH CONFIGURATION %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_FDW:
snprintf(buf, bufsize, "FOREIGN DATA WRAPPER %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_FOREIGN_SERVER:
snprintf(buf, bufsize, "FOREIGN SERVER %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_DEFAULT_ACL:
snprintf(buf, bufsize, "DEFAULT ACL %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return; case DO_LARGE_OBJECT:
snprintf(buf, bufsize, "LARGE OBJECT (ID %d OID %u)",
obj->dumpId, obj->catId.oid); return; case DO_LARGE_OBJECT_DATA:
snprintf(buf, bufsize, "LARGE OBJECT DATA (ID %d)",
obj->dumpId); return; case DO_POLICY:
snprintf(buf, bufsize, "POLICY (ID %d OID %u)",
obj->dumpId, obj->catId.oid); return; case DO_PUBLICATION:
snprintf(buf, bufsize, "PUBLICATION (ID %d OID %u)",
obj->dumpId, obj->catId.oid); return; case DO_PUBLICATION_REL:
snprintf(buf, bufsize, "PUBLICATION TABLE (ID %d OID %u)",
obj->dumpId, obj->catId.oid); return; case DO_PUBLICATION_TABLE_IN_SCHEMA:
snprintf(buf, bufsize, "PUBLICATION TABLES IN SCHEMA (ID %d OID %u)",
obj->dumpId, obj->catId.oid); return; case DO_SUBSCRIPTION:
snprintf(buf, bufsize, "SUBSCRIPTION (ID %d OID %u)",
obj->dumpId, obj->catId.oid); return; case DO_SUBSCRIPTION_REL:
snprintf(buf, bufsize, "SUBSCRIPTION TABLE (ID %d OID %u)",
obj->dumpId, obj->catId.oid); return; case DO_PRE_DATA_BOUNDARY:
snprintf(buf, bufsize, "PRE-DATA BOUNDARY (ID %d)",
obj->dumpId); return; case DO_POST_DATA_BOUNDARY:
snprintf(buf, bufsize, "POST-DATA BOUNDARY (ID %d)",
obj->dumpId); return; case DO_REL_STATS:
snprintf(buf, bufsize, "RELATION STATISTICS FOR %s (ID %d OID %u)",
obj->name, obj->dumpId, obj->catId.oid); return;
} /* shouldn't get here */
snprintf(buf, bufsize, "object type %d (ID %d OID %u)",
(int) obj->objType,
obj->dumpId, obj->catId.oid);
}
/* binaryheap comparator that compares "a" and "b" as integers */ staticint
int_cmp(void *a, void *b, void *arg)
{ int ai = (int) (intptr_t) a; int bi = (int) (intptr_t) b;
return pg_cmp_s32(ai, bi);
}
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.22Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-08-07)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.