Introduce --no-superuser-check option.
The current client checks for superuser before attempting to execute pg_repack commands. In Amazon RDS, customers are given access to a psuedo-superuser role called rds_superuser, but they are not given access to superuser. However, rds_superusers will otherwise have the ability to execute pg_repack commands in RDS. This change introduces the --no-superuser-check option in the client code so that users can disable the client-side superuser checks.
This commit is contained in:
parent
dfbedb63d9
commit
168676b3b6
@ -244,6 +244,7 @@ static int wait_timeout = 60; /* in seconds */
|
|||||||
static int jobs = 0; /* number of concurrent worker conns. */
|
static int jobs = 0; /* number of concurrent worker conns. */
|
||||||
static bool dryrun = false;
|
static bool dryrun = false;
|
||||||
static unsigned int temp_obj_num = 0; /* temporary objects counter */
|
static unsigned int temp_obj_num = 0; /* temporary objects counter */
|
||||||
|
static bool no_superuser_check = false;
|
||||||
|
|
||||||
/* buffer should have at least 11 bytes */
|
/* buffer should have at least 11 bytes */
|
||||||
static char *
|
static char *
|
||||||
@ -269,6 +270,7 @@ static pgut_option options[] =
|
|||||||
{ 'i', 'T', "wait-timeout", &wait_timeout },
|
{ 'i', 'T', "wait-timeout", &wait_timeout },
|
||||||
{ 'B', 'Z', "no-analyze", &analyze },
|
{ 'B', 'Z', "no-analyze", &analyze },
|
||||||
{ 'i', 'j', "jobs", &jobs },
|
{ 'i', 'j', "jobs", &jobs },
|
||||||
|
{ 'b', 'k', "no-superuser-check", &no_superuser_check },
|
||||||
{ 0 },
|
{ 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -371,6 +373,9 @@ is_superuser(void)
|
|||||||
{
|
{
|
||||||
const char *val;
|
const char *val;
|
||||||
|
|
||||||
|
if (no_superuser_check)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (!connection)
|
if (!connection)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -2064,4 +2069,5 @@ pgut_help(bool details)
|
|||||||
printf(" -x, --only-indexes move only indexes of the specified table\n");
|
printf(" -x, --only-indexes move only indexes of the specified table\n");
|
||||||
printf(" -T, --wait-timeout=SECS timeout to cancel other backends on conflict\n");
|
printf(" -T, --wait-timeout=SECS timeout to cancel other backends on conflict\n");
|
||||||
printf(" -Z, --no-analyze don't analyze at end\n");
|
printf(" -Z, --no-analyze don't analyze at end\n");
|
||||||
|
printf(" -k, --no-superuser-check skip superuser checks in client\n");
|
||||||
}
|
}
|
||||||
|
@ -128,6 +128,7 @@ Options:
|
|||||||
-x, --only-indexes move only indexes of the specified table
|
-x, --only-indexes move only indexes of the specified table
|
||||||
-T, --wait-timeout=SECS timeout to cancel other backends on conflict
|
-T, --wait-timeout=SECS timeout to cancel other backends on conflict
|
||||||
-Z, --no-analyze don't analyze at end
|
-Z, --no-analyze don't analyze at end
|
||||||
|
-k, --no-superuser-check skip superuser checks in client
|
||||||
|
|
||||||
Connection options:
|
Connection options:
|
||||||
-d, --dbname=DBNAME database to connect
|
-d, --dbname=DBNAME database to connect
|
||||||
@ -210,6 +211,10 @@ Reorg Options
|
|||||||
Disable ANALYZE after a full-table reorganization. If not specified, run
|
Disable ANALYZE after a full-table reorganization. If not specified, run
|
||||||
ANALYZE after the reorganization.
|
ANALYZE after the reorganization.
|
||||||
|
|
||||||
|
``-k``, ``--no-superuser-check``
|
||||||
|
Skip the superuser checks in the client. This setting is useful for using
|
||||||
|
pg_repack on platforms that support running it as non-superusers.
|
||||||
|
|
||||||
|
|
||||||
Connection Options
|
Connection Options
|
||||||
^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
Loading…
x
Reference in New Issue
Block a user