提交 2154dfae 编写于 作者: F Fenggang 提交者: Georgios Kokolatos

Fix issue for "grant all on all tables in schema xxx to yyy;"

It has been discovered in GPDB v.6 and above that a 'GRAND ALL ON ALL TABLES IN
SCHEMA XXX TO YYY;' statement will lead to PANIC.

From the resulted coredumps, a now obsolete code in QD that tried to encode
objects in a partition reference into RangeVars was identified as the culprit.
The list that the resulting vars were ancored, was expecting and treating only
StrVars. The original code was added following the premise that catalog
informations were not available in Segments. Also it tried to optimise caching,
yet the code was not fully writen.

Instead, the offending block is removed which solves the issue and allows for
greater alignment with upstream.
Reviewed-by: NGeorgios Kokolatos <gkokolatos@pivotal.io>
(cherry picked from commit ba6148c6)
上级 c4618266
......@@ -493,25 +493,6 @@ ExecuteGrantStmt(GrantStmt *stmt)
istmt.objects = objs;
}
/* If we're dispatching, put the objects back in into the parse tree */
if (Gp_role == GP_ROLE_DISPATCH && added_objs)
{
List *n = NIL;
foreach(cell, istmt.objects)
{
Oid rid = lfirst_oid(cell);
RangeVar *rv;
char *nspname = get_namespace_name(get_rel_namespace(rid));
char *relname = get_rel_name(rid);
rv = makeRangeVar(nspname, relname, -1);
n = lappend(n, rv);
}
stmt->objects = n;
}
/*
* Convert the PrivGrantee list into an Oid list. Note that at this point
* we insert an ACL_ID_PUBLIC into the list if an empty role name is
......
......@@ -1660,6 +1660,9 @@ SELECT d.* -- check that entries went away
CREATE SCHEMA testns;
CREATE TABLE testns.t1 (f1 int);
CREATE TABLE testns.t2 (f1 int);
CREATE TABLE testns.t3 (f1 int) PARTITION BY RANGE (f1) (START (2018) END (2020) EVERY (1),DEFAULT PARTITION extra );
CREATE TABLE testns.t4 (f1 int) inherits (testns.t1);
NOTICE: merging column "f1" with inherited definition
SELECT has_table_privilege('regressuser1', 'testns.t1', 'SELECT'); -- false
has_table_privilege
---------------------
......
......@@ -963,6 +963,8 @@ SELECT d.* -- check that entries went away
CREATE SCHEMA testns;
CREATE TABLE testns.t1 (f1 int);
CREATE TABLE testns.t2 (f1 int);
CREATE TABLE testns.t3 (f1 int) PARTITION BY RANGE (f1) (START (2018) END (2020) EVERY (1),DEFAULT PARTITION extra );
CREATE TABLE testns.t4 (f1 int) inherits (testns.t1);
SELECT has_table_privilege('regressuser1', 'testns.t1', 'SELECT'); -- false
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册