You must tell PostGreSQL what template1
the template is. If you do not, you will not be allowed to copy it unless you own it:
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';
/src/backend/commands/dbcommands.c
( Google), . :
if (!src_istemplate)
{
if (!pg_database_ownercheck(src_dboid, GetUserId()))
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied to copy database \"%s\"",
dbtemplate)));
}
,