1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-18 12:22:09 +03:00

Allow CREATE/ALTER DATABASE to manipulate datistemplate and datallowconn.

Historically these database properties could be manipulated only by
manually updating pg_database, which is error-prone and only possible for
superusers.  But there seems no good reason not to allow database owners to
set them for their databases, so invent CREATE/ALTER DATABASE options to do
that.  Adjust a couple of places that were doing it the hard way to use the
commands instead.

Vik Fearing, reviewed by Pavel Stehule
This commit is contained in:
Tom Lane
2014-07-01 20:10:38 -04:00
parent 15c82efd69
commit fbb1d7d73f
7 changed files with 135 additions and 30 deletions

View File

@@ -28,6 +28,8 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
[ LC_COLLATE [=] <replaceable class="parameter">lc_collate</replaceable> ]
[ LC_CTYPE [=] <replaceable class="parameter">lc_ctype</replaceable> ]
[ TABLESPACE [=] <replaceable class="parameter">tablespace_name</replaceable> ]
[ IS_TEMPLATE [=] <replaceable class="parameter">istemplate</replaceable> ]
[ ALLOW_CONNECTIONS [=] <replaceable class="parameter">allowconn</replaceable> ]
[ CONNECTION LIMIT [=] <replaceable class="parameter">connlimit</replaceable> ] ]
</synopsis>
</refsynopsisdiv>
@@ -148,6 +150,28 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">istemplate</replaceable></term>
<listitem>
<para>
If true, then this database can be cloned by any user with CREATEDB
privileges; if false (the default), then only superusers or the owner
of the database can clone it.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">allowconn</replaceable></term>
<listitem>
<para>
If false then no one can connect to this database. The default is
true, allowing connections (except as restricted by other mechanisms,
such as <literal>GRANT</>/<literal>REVOKE CONNECT</>).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">connlimit</replaceable></term>
<listitem>
<para>