!1099 添加一些shutdown命令的禁止权限

Merge pull request !1099 from gentle_hu/shutdown
This commit is contained in:
opengauss-bot
2021-07-23 03:30:07 +00:00
committed by Gitee
2 changed files with 5 additions and 1 deletions

View File

@ -1077,7 +1077,7 @@ stmt :
| RuleStmt
| SecLabelStmt
| SelectStmt
| ShutdownStmt
| ShutdownStmt
| TransactionStmt
| TruncateStmt
| UnlistenStmt

View File

@ -29,6 +29,10 @@
void DoShutdown(ShutdownStmt* stmt)
{
#ifdef ENABLE_MULTIPLE_NODES
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("SHUTDOWN is not supported in distributed mode.")));
#endif
if (!superuser()) {
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), (errmsg("Only system admin can shutdown database."))));