mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +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:
@ -25,6 +25,8 @@ ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <rep
|
||||
|
||||
<phrase>where <replaceable class="PARAMETER">option</replaceable> can be:</phrase>
|
||||
|
||||
IS_TEMPLATE <replaceable class="PARAMETER">istemplate</replaceable>
|
||||
ALLOW_CONNECTIONS <replaceable class="PARAMETER">allowconn</replaceable>
|
||||
CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable>
|
||||
|
||||
ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
|
||||
@ -107,6 +109,26 @@ ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RESET ALL
|
||||
</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, 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.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">connlimit</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user