mirror of
https://github.com/postgres/postgres.git
synced 2025-06-29 10:41:53 +03:00
Rethink method for assigning OIDs to the template0 and postgres DBs.
Commitaa0105141
assigned fixed OIDs to template0 and postgres in a very ad-hoc way. Notably, instead of teaching Catalog.pm about these OIDs, the unused_oids script was just hacked to not show them as unused. That's problematic since, for example, duplicate_oids wouldn't report any future conflict. Hence, invent a macro DECLARE_OID_DEFINING_MACRO() that can be used to define an OID that is known to Catalog.pm and will participate in duplicate-detection as well as renumbering by renumber_oids.pl. (We don't anticipate renumbering these particular OIDs, but we might as well build out all the Catalog.pm infrastructure while we're here.) Another issue is thataa0105141
neglected to touch IsPinnedObject, with the result that it now claimed template0 and postgres are pinned. The right thing to do there seems to be to teach it that no database is pinned, since in fact DROP DATABASE doesn't check for pinned-ness (and at least for these cases, that is an intentional choice). It's not clear whether this wrong answer had any visible effect, but perhaps it could have resulted in erroneous management of dependency entries. In passing, rename the TemplateDbOid macro to Template1DbOid to reduce confusion (likely we should have done that way back when we invented template0, but we didn't), and rename the OID macros for template0 and postgres to have a similar style. There are no changes to postgres.bki here, so no need for a catversion bump. Discussion: https://postgr.es/m/2935358.1650479692@sss.pgh.pa.us
This commit is contained in:
@ -4540,9 +4540,9 @@ BootStrapXLOG(void)
|
||||
checkPoint.nextMulti = FirstMultiXactId;
|
||||
checkPoint.nextMultiOffset = 0;
|
||||
checkPoint.oldestXid = FirstNormalTransactionId;
|
||||
checkPoint.oldestXidDB = TemplateDbOid;
|
||||
checkPoint.oldestXidDB = Template1DbOid;
|
||||
checkPoint.oldestMulti = FirstMultiXactId;
|
||||
checkPoint.oldestMultiDB = TemplateDbOid;
|
||||
checkPoint.oldestMultiDB = Template1DbOid;
|
||||
checkPoint.oldestCommitTsXid = InvalidTransactionId;
|
||||
checkPoint.newestCommitTsXid = InvalidTransactionId;
|
||||
checkPoint.time = (pg_time_t) time(NULL);
|
||||
|
Reference in New Issue
Block a user