修复统一superuser定义的残留bug
This commit is contained in:
@ -12881,9 +12881,9 @@ const char* GetConfigOption(const char* name, bool missing_ok, bool restrict_sup
|
||||
ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("unrecognized configuration parameter \"%s\"", name)));
|
||||
}
|
||||
|
||||
if (restrict_superuser && (record->flags & GUC_SUPERUSER_ONLY) && (GetUserId() != BOOTSTRAP_SUPERUSERID))
|
||||
if (restrict_superuser && (record->flags & GUC_SUPERUSER_ONLY) && !superuser())
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("must be initial account to examine \"%s\"", name)));
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("must be superuser to examine \"%s\"", name)));
|
||||
|
||||
switch (record->vartype) {
|
||||
case PGC_BOOL:
|
||||
@ -12935,9 +12935,9 @@ const char* GetConfigOptionResetString(const char* name)
|
||||
if (record == NULL)
|
||||
ereport(
|
||||
ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("unrecognized configuration parameter \"%s\"", name)));
|
||||
if ((record->flags & GUC_SUPERUSER_ONLY) && (GetUserId() != BOOTSTRAP_SUPERUSERID))
|
||||
if ((record->flags & GUC_SUPERUSER_ONLY) && !superuser())
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("must be initial account to examine \"%s\"", name)));
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("must be superuser to examine \"%s\"", name)));
|
||||
|
||||
switch (record->vartype) {
|
||||
case PGC_BOOL:
|
||||
@ -14115,7 +14115,7 @@ static void ShowGUCConfigOption(const char* name, DestReceiver* dest)
|
||||
*/
|
||||
static void ShowAllGUCConfig(DestReceiver* dest)
|
||||
{
|
||||
bool am_superuser = (GetUserId() == BOOTSTRAP_SUPERUSERID);
|
||||
bool am_superuser = superuser();
|
||||
int i;
|
||||
TupOutputState* tstate = NULL;
|
||||
TupleDesc tupdesc;
|
||||
|
@ -19,11 +19,11 @@ ALTER SYSTEM SET
|
||||
\! @gsqldir@/gsql -d postgres -p 25632 -U grant_all -W openGauss@123 -c "alter system set password_reuse_max=0;"
|
||||
ALTER SYSTEM SET
|
||||
\! @gsqldir@/gsql -d postgres -p 25632 -U standard_user -W openGauss@123 -c "show password_reuse_max;";
|
||||
ERROR: must be initial account to examine "password_reuse_max"
|
||||
ERROR: must be superuser to examine "password_reuse_max"
|
||||
\! @gsqldir@/gsql -d postgres -p 25632 -U standard_user -W openGauss@123 -c "alter system set password_reuse_max=1;";
|
||||
ERROR: must be superuser to execute ALTER SYSTEM SET command
|
||||
\! @gsqldir@/gsql -d postgres -p 25632 -U standard_user -W openGauss@123 -c "show password_reuse_max;";
|
||||
ERROR: must be initial account to examine "password_reuse_max"
|
||||
ERROR: must be superuser to examine "password_reuse_max"
|
||||
\! @gsqldir@/gsql -d postgres -p 25632 -U standard_user -W openGauss@123 -c "alter system set password_reuse_max=0;"
|
||||
ERROR: must be superuser to execute ALTER SYSTEM SET command
|
||||
show password_reuse_max;
|
||||
@ -58,11 +58,11 @@ SET
|
||||
\! @gsqldir@/gsql -d postgres -p 25632 -U grant_all -W openGauss@123 -c "set pljava_vmoptions='';"
|
||||
SET
|
||||
\! @gsqldir@/gsql -d postgres -p 25632 -U standard_user -W openGauss@123 -c "show pljava_vmoptions;";
|
||||
ERROR: must be initial account to examine "pljava_vmoptions"
|
||||
ERROR: must be superuser to examine "pljava_vmoptions"
|
||||
\! @gsqldir@/gsql -d postgres -p 25632 -U standard_user -W openGauss@123 -c "set pljava_vmoptions='aaa';";
|
||||
ERROR: permission denied to set parameter "pljava_vmoptions"
|
||||
\! @gsqldir@/gsql -d postgres -p 25632 -U standard_user -W openGauss@123 -c "show pljava_vmoptions;";
|
||||
ERROR: must be initial account to examine "pljava_vmoptions"
|
||||
ERROR: must be superuser to examine "pljava_vmoptions"
|
||||
\! @gsqldir@/gsql -d postgres -p 25632 -U standard_user -W openGauss@123 -c "set pljava_vmoptions='';"
|
||||
ERROR: permission denied to set parameter "pljava_vmoptions"
|
||||
show pljava_vmoptions;
|
||||
|
Reference in New Issue
Block a user