On Mon, May 22, 2023 at 08:42:28AM +0200, Peter Eisentraut wrote:
> On 21.05.23 19:07, Nathan Bossart wrote:
>> How do folks feel about keeping --role undocumented?  Should we give it a
>> mention in the docs for --member-of?
> 
> We made a point in this release to document deprecated options consistently.
> See commit 2f80c95740.

Alright.  Does the attached patch suffice?

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
diff --git a/doc/src/sgml/ref/createuser.sgml b/doc/src/sgml/ref/createuser.sgml
index ba7ed1f853..5c34c62342 100644
--- a/doc/src/sgml/ref/createuser.sgml
+++ b/doc/src/sgml/ref/createuser.sgml
@@ -150,6 +150,7 @@ PostgreSQL documentation
      <varlistentry>
       <term><option>-g <replaceable class="parameter">role</replaceable></option></term>
       <term><option>--member-of=<replaceable class="parameter">role</replaceable></option></term>
+      <term><option>--role=<replaceable class="parameter">role</replaceable></option> (deprecated)</term>
       <listitem>
        <para>
         Specifies the new role should be automatically added as a member
diff --git a/src/bin/scripts/createuser.c b/src/bin/scripts/createuser.c
index 2d5e2452f7..0709491185 100644
--- a/src/bin/scripts/createuser.c
+++ b/src/bin/scripts/createuser.c
@@ -34,8 +34,7 @@ main(int argc, char *argv[])
 		{"no-createdb", no_argument, NULL, 'D'},
 		{"echo", no_argument, NULL, 'e'},
 		{"encrypted", no_argument, NULL, 'E'},
-		{"role", required_argument, NULL, 'g'}, /* kept for backward
-												 * compatibility */
+		{"role", required_argument, NULL, 'g'},
 		{"member-of", required_argument, NULL, 'g'},
 		{"host", required_argument, NULL, 'h'},
 		{"inherit", no_argument, NULL, 'i'},
@@ -423,6 +422,7 @@ help(const char *progname)
 	printf(_("  -D, --no-createdb         role cannot create databases (default)\n"));
 	printf(_("  -e, --echo                show the commands being sent to the server\n"));
 	printf(_("  -g, --member-of=ROLE      new role will be a member of ROLE\n"));
+	printf(_("  --role=ROLE               (same as --member-of, deprecated)\n"));
 	printf(_("  -i, --inherit             role inherits privileges of roles it is a\n"
 			 "                            member of (default)\n"));
 	printf(_("  -I, --no-inherit          role does not inherit privileges\n"));
diff --git a/src/bin/scripts/t/040_createuser.pl b/src/bin/scripts/t/040_createuser.pl
index 40452fcae3..9ca282181d 100644
--- a/src/bin/scripts/t/040_createuser.pl
+++ b/src/bin/scripts/t/040_createuser.pl
@@ -71,7 +71,7 @@ $node->issues_sql_like(
 $node->issues_sql_like(
 	[ 'createuser', '--role', 'regress_user1', 'regress_user11' ],
 	qr/statement: CREATE ROLE regress_user11 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN NOREPLICATION NOBYPASSRLS IN ROLE regress_user1;/,
-	'--role (for backward compatibility)');
+	'--role');
 $node->issues_sql_like(
 	[ 'createuser', '--member-of', 'regress_user1', 'regress_user12' ],
 	qr/statement: CREATE ROLE regress_user12 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN NOREPLICATION NOBYPASSRLS IN ROLE regress_user1;/,

Reply via email to