Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb056b71

Browse files
committed
Add --{no-,}replication flags to createuser.
Fujii Masao, reviewed by Cédric Villemain, with some doc changes by me.
1 parente5e2f7b commitb056b71

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

‎doc/src/sgml/ref/createuser.sgml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,28 @@ PostgreSQL documentation
240240
</listitem>
241241
</varlistentry>
242242

243+
<varlistentry>
244+
<term><option>--replication</></term>
245+
<listitem>
246+
<para>
247+
The new user will have the REPLICATION privilege, which is
248+
described more fully in the documentation for
249+
<xref linkend="sql-createrole">.
250+
</para>
251+
</listitem>
252+
</varlistentry>
253+
254+
<varlistentry>
255+
<term><option>--no-replication</></term>
256+
<listitem>
257+
<para>
258+
The new user will not have the REPLICATION privilege, which is
259+
described more fully in the documentation for
260+
<xref linkend="sql-createrole">.
261+
</para>
262+
</listitem>
263+
</varlistentry>
264+
243265
<varlistentry>
244266
<term><option>-V</></term>
245267
<term><option>--version</></term>

‎src/bin/scripts/createuser.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ main(int argc, char *argv[])
3737
{"no-inherit",no_argument,NULL,'I'},
3838
{"login",no_argument,NULL,'l'},
3939
{"no-login",no_argument,NULL,'L'},
40+
{"replication",no_argument,NULL,1},
41+
{"no-replication",no_argument,NULL,2},
4042
/* adduser is obsolete, undocumented spelling of superuser */
4143
{"adduser",no_argument,NULL,'a'},
4244
{"no-adduser",no_argument,NULL,'A'},
@@ -66,6 +68,7 @@ main(int argc, char *argv[])
6668
createrole=TRI_DEFAULT,
6769
inherit=TRI_DEFAULT,
6870
login=TRI_DEFAULT,
71+
replication=TRI_DEFAULT,
6972
encrypted=TRI_DEFAULT;
7073

7174
PQExpBufferDatasql;
@@ -145,6 +148,12 @@ main(int argc, char *argv[])
145148
case'N':
146149
encrypted=TRI_NO;
147150
break;
151+
case1:
152+
replication=TRI_YES;
153+
break;
154+
case2:
155+
replication=TRI_NO;
156+
break;
148157
default:
149158
fprintf(stderr,_("Try \"%s --help\" for more information.\n"),progname);
150159
exit(1);
@@ -271,6 +280,10 @@ main(int argc, char *argv[])
271280
appendPQExpBuffer(&sql," LOGIN");
272281
if (login==TRI_NO)
273282
appendPQExpBuffer(&sql," NOLOGIN");
283+
if (replication==TRI_YES)
284+
appendPQExpBuffer(&sql," REPLICATION");
285+
if (replication==TRI_NO)
286+
appendPQExpBuffer(&sql," NOREPLICATION");
274287
if (conn_limit!=NULL)
275288
appendPQExpBuffer(&sql," CONNECTION LIMIT %s",conn_limit);
276289
appendPQExpBuffer(&sql,";\n");
@@ -316,6 +329,8 @@ help(const char *progname)
316329
printf(_(" -R, --no-createrole role cannot create roles\n"));
317330
printf(_(" -s, --superuser role will be superuser\n"));
318331
printf(_(" -S, --no-superuser role will not be superuser\n"));
332+
printf(_(" --replication role can initiate replication\n"));
333+
printf(_(" --no-replication role cannot initiate replication\n"));
319334
printf(_(" --help show this help, then exit\n"));
320335
printf(_(" --version output version information, then exit\n"));
321336
printf(_("\nConnection options:\n"));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp