mirror of
https://github.com/postgres/postgres.git
synced 2025-08-15 14:02:29 +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:
@@ -2288,11 +2288,7 @@ make_template0(void)
|
||||
PG_CMD_DECL;
|
||||
const char **line;
|
||||
static const char *template0_setup[] = {
|
||||
"CREATE DATABASE template0;\n",
|
||||
"UPDATE pg_database SET "
|
||||
" datistemplate = 't', "
|
||||
" datallowconn = 'f' "
|
||||
" WHERE datname = 'template0';\n",
|
||||
"CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;\n",
|
||||
|
||||
/*
|
||||
* We use the OID of template0 to determine lastsysoid
|
||||
|
Reference in New Issue
Block a user