Re: Is template1 intended to have oid 1 ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chapman Flack <chap(at)anastigmatix(dot)net>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Is template1 intended to have oid 1 ?
Date: 2021-05-09 22:40:25
Message-ID: 543832.1620600025@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Chapman Flack <chap(at)anastigmatix(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Osahon Oduware 2021-05-09 22:55:47 Fwd: DOCS.zip - Request for access
Previous Message Andres Freund 2021-05-09 22:40:06 Re: Non-reproducible valgrind failure on HEAD