!614 修复统一superuser定义的残留bug

Merge pull request !614 from Cross-罗/1.1.0
This commit is contained in:
opengauss-bot 2021-01-29 09:08:44 +08:00 committed by Gitee
commit b91f261cd6
2 changed files with 9 additions and 9 deletions

View File

@ -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:
@ -14186,7 +14186,7 @@ char* GetConfigOptionByName(const char* name, const char** varname)
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)));
if (varname != NULL)
*varname = record->name;

View File

@ -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;