From fbb1d7d73f8e23a3a61e702629c53cef48cb0918 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 1 Jul 2014 20:10:38 -0400 Subject: 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 --- doc/src/sgml/ref/alter_database.sgml | 22 ++++++++++++++++++++++ doc/src/sgml/ref/create_database.sgml | 24 ++++++++++++++++++++++++ 2 files changed, 46 insertions(+) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/alter_database.sgml b/doc/src/sgml/ref/alter_database.sgml index 23ef75512f1..3724c05e2c0 100644 --- a/doc/src/sgml/ref/alter_database.sgml +++ b/doc/src/sgml/ref/alter_database.sgml @@ -25,6 +25,8 @@ ALTER DATABASE name [ [ WITH ] where option can be: + IS_TEMPLATE istemplate + ALLOW_CONNECTIONS allowconn CONNECTION LIMIT connlimit ALTER DATABASE name RENAME TO new_name @@ -107,6 +109,26 @@ ALTER DATABASE name RESET ALL + istemplate + + + 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. + + + + + + allowconn + + + If false then no one can connect to this database. + + + + + connlimit diff --git a/doc/src/sgml/ref/create_database.sgml b/doc/src/sgml/ref/create_database.sgml index 5af89815207..9711b1f98e3 100644 --- a/doc/src/sgml/ref/create_database.sgml +++ b/doc/src/sgml/ref/create_database.sgml @@ -28,6 +28,8 @@ CREATE DATABASE name [ LC_COLLATE [=] lc_collate ] [ LC_CTYPE [=] lc_ctype ] [ TABLESPACE [=] tablespace_name ] + [ IS_TEMPLATE [=] istemplate ] + [ ALLOW_CONNECTIONS [=] allowconn ] [ CONNECTION LIMIT [=] connlimit ] ] @@ -148,6 +150,28 @@ CREATE DATABASE name + istemplate + + + 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. + + + + + + allowconn + + + If false then no one can connect to this database. The default is + true, allowing connections (except as restricted by other mechanisms, + such as GRANT/REVOKE CONNECT). + + + + + connlimit -- cgit v1.2.3