/* Quick out for cache hit */ if (OidIsValid(last_roleid) && last_roleid == roleid) return last_roleid_is_super;
/* Special escape path in case you deleted all your users. */ if (!IsUnderPostmaster && roleid == BOOTSTRAP_SUPERUSERID) returntrue;
/* OK, look up the information in pg_authid */
rtup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid)); if (HeapTupleIsValid(rtup))
{
result = ((Form_pg_authid) GETSTRUCT(rtup))->rolsuper;
ReleaseSysCache(rtup);
} else
{ /* Report "not superuser" for invalid roleids */
result = false;
}
/* If first time through, set up callback for cache flushes */ if (!roleid_callback_registered)
{
CacheRegisterSyscacheCallback(AUTHOID,
RoleidCallback,
(Datum) 0);
roleid_callback_registered = true;
}
/* Cache the result for next time */
last_roleid = roleid;
last_roleid_is_super = result;
return result;
}
/* *RoleidCallback *Syscacheinvalcallbackfunction
*/ staticvoid
RoleidCallback(Datum arg, int cacheid, uint32 hashvalue)
{ /* Invalidate our local cache in case role's superuserness changed */
last_roleid = InvalidOid;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet am 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.