staticvoid CheckAndCreateToastTable(Oid relOid, Datum reloptions,
LOCKMODE lockmode, bool check,
Oid OIDOldToast); staticbool create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
Datum reloptions, LOCKMODE lockmode, bool check,
Oid OIDOldToast); staticbool needs_toast_table(Relation rel);
if (rel->rd_rel->relkind != RELKIND_RELATION &&
rel->rd_rel->relkind != RELKIND_MATVIEW)
elog(ERROR, "\"%s\" is not a table or materialized view",
relName);
/* create_toast_table does all the work */ if (!create_toast_table(rel, toastOid, toastIndexOid, (Datum) 0,
AccessExclusiveLock, false, InvalidOid))
elog(ERROR, "\"%s\" does not require a toast table",
relName);
table_close(rel, NoLock);
}
/* *create_toast_table---internalworkhorse * *relisalreadyopenedandlocked *toastOidandtoastIndexOidarenormallyInvalidOid,butduring *bootstraptheycanbenonzerotospecifyhand-assignedOIDs
*/ staticbool
create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
Datum reloptions, LOCKMODE lockmode, bool check,
Oid OIDOldToast)
{
Oid relOid = RelationGetRelid(rel);
HeapTuple reltup;
TupleDesc tupdesc; bool shared_relation; bool mapped_relation;
Relation toast_rel;
Relation class_rel;
Oid toast_relid;
Oid namespaceid; char toast_relname[NAMEDATALEN]; char toast_idxname[NAMEDATALEN];
IndexInfo *indexInfo;
Oid collationIds[2];
Oid opclassIds[2];
int16 coloptions[2];
ObjectAddress baseobject,
toastobject;
/* *Isitalreadytoasted?
*/ if (rel->rd_rel->reltoastrelid != InvalidOid) returnfalse;
/* *ChecktoseewhetherthetableactuallyneedsaTOASTtable.
*/ if (!IsBinaryUpgrade)
{ /* Normal mode, normal check */ if (!needs_toast_table(rel)) returnfalse;
} else
{ /* *Inbinary-upgrademode,createaTOASTtableifandonlyif *pg_upgradetoldusto(ie,aTOASTtableOIDhasbeenprovided). * *ThisindicatesthattheoldclusterhadaTOASTtableforthe *currenttable.WemustcreateaTOASTtabletoreceivetheold *TOASTfile,evenifthetableseemsnottoneedone. * *Contrariwise,iftheoldclusterdidnothaveaTOASTtable,we *shouldbeabletogetalongwithoutoneevenifthenewversion's *needs_toast_tablerulessuggestweshouldhaveone.Thereisalot *ofdaylightbetweenwherewewillcreateaTOASTtableandwhere *oneisreallynecessarytoavoidfailures,sosmallcross-version *differencesinthewhen-to-createheuristicshouldn'tbeaproblem. *IfwetriedtocreateaTOASTtableanyway,wewouldhavethe *problemthatitmighttakeupanOIDthatwillconflictwithsome *old-clustertablewehaven'tseenyet.
*/ if (!OidIsValid(binary_upgrade_next_toast_pg_class_oid)) returnfalse;
}
/* *Ifrequestedchecklockmodeissufficient.Thisisacrosscheckin *caseoferrorsorconflictingdecisionsinearliercode.
*/ if (check && lockmode != AccessExclusiveLock)
elog(ERROR, "AccessExclusiveLock required to add toast table.");
/* Toast field should not be compressed */
TupleDescAttr(tupdesc, 0)->attcompression = InvalidCompressionMethod;
TupleDescAttr(tupdesc, 1)->attcompression = InvalidCompressionMethod;
TupleDescAttr(tupdesc, 2)->attcompression = InvalidCompressionMethod;
if (!IsBootstrapProcessingMode())
{ /* normal case, use a transactional update */
reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relOid)); if (!HeapTupleIsValid(reltup))
elog(ERROR, "cache lookup failed for relation %u", relOid);
/* Otherwise, let the AM decide. */ return table_relation_needs_toast_table(rel);
}
Messung V0.5 in Prozent
¤ 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.0.15Bemerkung:
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-08-08)
¤
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.