diff --git a/doc/src/sgml/ref/createuser.sgml b/doc/src/sgml/ref/createuser.sgml
index 0c47fb4..58846d3 100644
--- a/doc/src/sgml/ref/createuser.sgml
+++ b/doc/src/sgml/ref/createuser.sgml
@@ -241,6 +241,28 @@ PostgreSQL documentation
+
+
+
+
+ The new user will be allowed to initiate streaming replication
+ or put the system in and out of backup mode.
+
+
+
+
+
+
+
+
+
+ The new user will not be allowed to initiate streaming replication
+ or put the system in and out of backup mode. This is the default.
+
+
+
+
+
diff --git a/src/bin/scripts/createuser.c b/src/bin/scripts/createuser.c
index 04bbebc..556ebaa 100644
--- a/src/bin/scripts/createuser.c
+++ b/src/bin/scripts/createuser.c
@@ -37,6 +37,8 @@ main(int argc, char *argv[])
{"no-inherit", no_argument, NULL, 'I'},
{"login", no_argument, NULL, 'l'},
{"no-login", no_argument, NULL, 'L'},
+ {"replication", no_argument, NULL, 'x'},
+ {"no-replication", no_argument, NULL, 'X'},
/* adduser is obsolete, undocumented spelling of superuser */
{"adduser", no_argument, NULL, 'a'},
{"no-adduser", no_argument, NULL, 'A'},
@@ -66,6 +68,7 @@ main(int argc, char *argv[])
createrole = TRI_DEFAULT,
inherit = TRI_DEFAULT,
login = TRI_DEFAULT,
+ replication = TRI_DEFAULT,
encrypted = TRI_DEFAULT;
PQExpBufferData sql;
@@ -78,7 +81,7 @@ main(int argc, char *argv[])
handle_help_version_opts(argc, argv, "createuser", help);
- while ((c = getopt_long(argc, argv, "h:p:U:wWedDsSaArRiIlLc:PEN",
+ while ((c = getopt_long(argc, argv, "h:p:U:wWedDsSaArRiIlLxXc:PEN",
long_options, &optindex)) != -1)
{
switch (c)
@@ -133,6 +136,12 @@ main(int argc, char *argv[])
case 'L':
login = TRI_NO;
break;
+ case 'x':
+ replication = TRI_YES;
+ break;
+ case 'X':
+ replication = TRI_NO;
+ break;
case 'c':
conn_limit = optarg;
break;
@@ -221,6 +230,9 @@ main(int argc, char *argv[])
if (login == 0)
login = TRI_YES;
+ if (replication == 0)
+ replication = TRI_NO;
+
conn = connectDatabase("postgres", host, port, username, prompt_password, progname);
initPQExpBuffer(&sql);
@@ -271,6 +283,10 @@ main(int argc, char *argv[])
appendPQExpBuffer(&sql, " LOGIN");
if (login == TRI_NO)
appendPQExpBuffer(&sql, " NOLOGIN");
+ if (replication == TRI_YES)
+ appendPQExpBuffer(&sql, " REPLICATION");
+ if (replication == TRI_NO)
+ appendPQExpBuffer(&sql, " NOREPLICATION");
if (conn_limit != NULL)
appendPQExpBuffer(&sql, " CONNECTION LIMIT %s", conn_limit);
appendPQExpBuffer(&sql, ";\n");
@@ -316,6 +332,8 @@ help(const char *progname)
printf(_(" -R, --no-createrole role cannot create roles\n"));
printf(_(" -s, --superuser role will be superuser\n"));
printf(_(" -S, --no-superuser role will not be superuser\n"));
+ printf(_(" -x, --replication role can initiate replication\n"));
+ printf(_(" -X, --no-replication role cannot initiate replication\n"));
printf(_(" --help show this help, then exit\n"));
printf(_(" --version output version information, then exit\n"));
printf(_("\nConnection options:\n"));