Re: datistemplate of pg_database does not behave as per description in documentation - Mailing list pgsql-hackers

From Tom Lane
Subject Re: datistemplate of pg_database does not behave as per description in documentation
Date
Msg-id 31029.1395920752@sss.pgh.pa.us
Whole thread Raw
In response to Re: datistemplate of pg_database does not behave as per description in documentation  (Magnus Hagander <magnus@hagander.net>)
Responses Re: datistemplate of pg_database does not behave as per description in documentation  (Magnus Hagander <magnus@hagander.net>)
Re: datistemplate of pg_database does not behave as per description in documentation  (Rajeev rastogi <rajeev.rastogi@huawei.com>)
List pgsql-hackers
Magnus Hagander <magnus@hagander.net> writes:
> On Thu, Mar 27, 2014 at 9:12 AM, Rajeev rastogi
> <rajeev.rastogi@huawei.com>wrote:
>> But current code does not behave in this manner.  Even if dbistemplate of
>> database is false, still it allows to be used as template database.

> AFAICT, the *only* thing datistemplate is used is to set parameters in
> autovacuum.

Huh?  The code comment is perfectly clear:
   /*    * Permission check: to copy a DB that's not marked datistemplate, you    * must be superuser or the owner
thereof.   */   if (!src_istemplate)   {       if (!pg_database_ownercheck(src_dboid, GetUserId()))
ereport(ERROR,                  (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),                    errmsg("permission denied
tocopy database \"%s\"",                           dbtemplate)));   }
 

I agree we need to make the docs match the code, but changing behavior
that's been like that for ten or fifteen years isn't the answer.

(Changing code and failing to adjust the adjacent comment is even less
of an answer.)
        regards, tom lane



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: datistemplate of pg_database does not behave as per description in documentation
Next
From: Tom Lane
Date:
Subject: Something flaky in the "relfilenode mapping" infrastructure