提交 f1fb5578 编写于 作者: A Ashwin Agrawal

Avoid superuser() from FTS message handler process.

FTS message handler process is special system process, which doesn't
have access to catalog. Hence, it shouldn't be performing any catalog
access. Calling `superuser()` via `set_gp_replication_config()` or
`pg_reload_conf()` results in error for the same reason. Hence, if
`am_ftshandler` process avoid calling `superuser()` and thereby avoid
catalog access. Rest all the stuff performed by this process doesn't
need catalog access.

Fixes #4764 github issue.
上级 591ba12e
......@@ -28,6 +28,7 @@
#include "funcapi.h"
#include "miscadmin.h"
#include "parser/keywords.h"
#include "postmaster/fts.h"
#include "postmaster/syslogger.h"
#include "rewrite/rewriteHandler.h"
#include "storage/fd.h"
......@@ -225,7 +226,7 @@ pg_terminate_backend_msg(PG_FUNCTION_ARGS)
Datum
pg_reload_conf(PG_FUNCTION_ARGS)
{
if (!superuser())
if (!am_ftshandler && !superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
(errmsg("must be superuser to signal the postmaster"))));
......
......@@ -57,6 +57,7 @@
#include "postmaster/autovacuum.h"
#include "postmaster/bgworker.h"
#include "postmaster/bgwriter.h"
#include "postmaster/fts.h"
#include "postmaster/postmaster.h"
#include "postmaster/syslogger.h"
#include "postmaster/walwriter.h"
......@@ -6998,7 +6999,7 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
struct stat st;
void *newextra = NULL;
if (!superuser())
if (!am_ftshandler && !superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
(errmsg("must be superuser to execute ALTER SYSTEM command"))));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册