aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/user.c
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2011-01-05 14:24:17 +0100
committerMagnus Hagander <magnus@hagander.net>2011-01-05 14:24:17 +0100
commit66a8a0428db046d725b88c8b956384c2a4b4a11c (patch)
treef04c0d6946f05f4bc15371c74ac5f8337dc9b50f /src/backend/commands/user.c
parent3302334b48e2be6eb2c01dcf500363dbd4f22e59 (diff)
downloadpostgresql-66a8a0428db046d725b88c8b956384c2a4b4a11c.tar.gz
postgresql-66a8a0428db046d725b88c8b956384c2a4b4a11c.zip
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).
Diffstat (limited to 'src/backend/commands/user.c')
-rw-r--r--src/backend/commands/user.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index 9e505b7525f..be049cb9945 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -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)