1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

Give superusers REPLIACTION permission by default

This can be overriden by using NOREPLICATION on the CREATE ROLE
statement, but by default they will have it, making it backwards
compatible and "less surprising" (given that superusers normally
override all checks).
This commit is contained in:
Magnus Hagander
2011-01-05 14:24:17 +01:00
parent 3302334b48
commit 66a8a0428d
6 changed files with 22 additions and 10 deletions

View File

@ -248,7 +248,15 @@ CreateRole(CreateRoleStmt *stmt)
if (dpassword && dpassword->arg)
password = strVal(dpassword->arg);
if (dissuper)
{
issuper = intVal(dissuper->arg) != 0;
/*
* Superusers get replication by default, but only if
* NOREPLICATION wasn't explicitly mentioned
*/
if (!(disreplication && intVal(disreplication->arg) == 0))
isreplication = 1;
}
if (dinherit)
inherit = intVal(dinherit->arg) != 0;
if (dcreaterole)