"David G. Johnston" <david.g.johnston@xxxxxxxxx> writes: > On Wed, Nov 9, 2022 at 1:54 PM Ron <ronljohnsonjr@xxxxxxxxx> wrote: >> But this raises a different question: when does the postgres database not >> exist? > You are giving it too much specialness. Both ALTER DATABASE ... RENAME and > DROP DATABASE can be used on it. The template databases aren't all that special either. There is a defense against dropping them accidentally: regression=# drop database template1; ERROR: cannot drop a template database but you can override that if you really mean it: regression=# alter database template1 with is_template false; ALTER DATABASE regression=# drop database template1; DROP DATABASE This might seem pretty scary, but it's intentional, per the comments in IsPinnedObject: * Databases are never pinned. It might seem that it'd be prudent to pin * at least template0; but we do this intentionally so that template0 and * template1 can be rebuilt from each other, thus letting them serve as * mutual backups (as long as you've not modified template1, anyway). regards, tom lane