Обсуждение: Is template1 intended to have oid 1 ?
Hello hackers, I've just noticed this in pg_database.dat: { oid => '1', oid_symbol => 'TemplateDbOid', descr => 'default template for new databases', datname => 'template1', ... but in the most recent cluster that I pg_upgraded, template1 has oid 16400. Nothing is acting broken, but ... is that supposed to happen? Regards, -Chap
Chapman Flack <chap@anastigmatix.net> writes: > I've just noticed this in pg_database.dat: > { oid => '1', oid_symbol => 'TemplateDbOid', > descr => 'default template for new databases', > datname => 'template1', ... > but in the most recent cluster that I pg_upgraded, template1 has oid 16400. > Nothing is acting broken, but ... is that supposed to happen? template1 does have OID 1 in a fresh-from-initdb cluster, but it's just a database; you can drop it and recreate it if you choose. I believe that pg_upgrade does so. (Technically, the same applies to template0. But our position on template0 is that changing the contents of that is unsupported. So pg_upgrade won't touch the target cluster's version of template0.) regards, tom lane
On 05/09/21 18:40, Tom Lane wrote: > template1 does have OID 1 in a fresh-from-initdb cluster, but it's > just a database; you can drop it and recreate it if you choose. > I believe that pg_upgrade does so. I guess it wouldn't even have made me curious, if I hadn't noticed the TemplateDbOid symbol being defined for it, which could end up being wrong after a pg_upgrade. I suppose if it is only ever referred to during bootstrap, no harm's done. Ironically, it might be the most prominently advertised oid_symbol there is, as that entry in pg_database.dat is what's used as the example of .dat-file format in bki.sgml. Regards, -Chap