<p dir="ltr"><br /> On Mar 27, 2014 12:45 PM, "Tom Lane" <<a
href="mailto:tgl@sss.pgh.pa.us">tgl@sss.pgh.pa.us</a>>wrote:<br /> ><br /> > Magnus Hagander <<a
href="mailto:magnus@hagander.net">magnus@hagander.net</a>>writes:<br /> > > On Thu, Mar 27, 2014 at 9:12 AM,
Rajeevrastogi<br /> > > <<a href="mailto:rajeev.rastogi@huawei.com">rajeev.rastogi@huawei.com</a>>wrote:<br
/>> >> But current code does not behave in this manner. Even if dbistemplate of<br /> > >> database
isfalse, still it allows to be used as template database.<br /> ><br /> > > AFAICT, the *only* thing
datistemplateis used is to set parameters in<br /> > > autovacuum.<br /> ><br /> > Huh? The code comment
isperfectly clear:<br /> ><br /> > /*<br /> > * Permission check: to copy a DB that's not marked
datistemplate,you<br /> > * must be superuser or the owner thereof.<br /> > */<br /> > if
(!src_istemplate)<br/> > {<br /> > if (!pg_database_ownercheck(src_dboid, GetUserId()))<br /> >
ereport(ERROR,<br /> > (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),<br /> >
errmsg("permission denied to copy database \"%s\"",<br /> > dbtemplate)));<br />
> }<br /> ><br /> > I agree we need to make the docs match the code, but changing behavior<br /> >
that'sbeen like that for ten or fifteen years isn't the answer.<p dir="ltr">Hah, I hadn't done more than git grep for
datistemplate:-) that's what I get for taking shortcuts... <p dir="ltr">But yes, fixing the documentation is what I
advocateas well. <br /><p dir="ltr">> (Changing code and failing to adjust the adjacent comment is even less<br />
>of an answer.)<p dir="ltr">I didn't even look at the suggested patch.. <p dir="ltr">/Magnus