On Mon, Aug 18, 2025 at 04:18:56PM -0400, Tom Lane wrote:
> Yeah. The logic about this is in pg_dump, actually: dumpDatabase()
> decides whether or not to add "UPDATE ... SET datistemplate = false"
> to the delQry. I was thinking about having it do that either if
> the source DB has datistemplate or if its name is template1.
> That would cover both (1) restoring a nonstandard set of databases
> into the original installation with --clean, and (2) restoring a
> nonstandard setup into a pristine installation. I don't think we
> need to account for template0 because neither pg_dumpall nor
> pg_upgrade will attempt to replace it.
>
> However, first I'd like confirmation that this theory explains
> the OP's problem.
WFM, provided your theory is correct.
--
nathan