提交 f0fc32e6 编写于 作者: D Daniel Gustafsson

Avoid setting unused variables

The range partition handling in get_part_rule() seemed to have some
parts copypasted from the list handling, and subsequently ended up
looking at and setting variables never to be read. Remove the unused
code and also ensure to exit early in case we weren't called with
the correct data.
Reviewed-by: NGeorgios Kokolatos <gkokolatos@pivotal.io>
上级 a4f623ae
......@@ -4899,6 +4899,9 @@ get_part_rule(Relation rel,
char relnamBuf[(NAMEDATALEN * 2)];
char *relname;
if (!pid)
return NULL;
snprintf(relnamBuf, sizeof(relnamBuf), "relation \"%s\"",
RelationGetRelationName(rel));
......@@ -4913,9 +4916,6 @@ get_part_rule(Relation rel,
bExistError, bMustExist,
pSearch, pNode, relname, NULL);
if (!pid)
return NULL;
if (pid->idtype == AT_AP_IDRule)
{
List *l1 = (List *) pid->partiddef;
......@@ -4932,20 +4932,8 @@ get_part_rule(Relation rel,
pid2 = (AlterPartitionId *) lfirst(lc);
prule2 = get_part_rule1(rel,
pid2,
bExistError, bMustExist,
pSearch, pNode, pstrdup(prule2->relname), &pNode2);
pNode = pNode2;
if (!pNode)
{
if (prule2 && prule2->topRule && prule2->topRule->children)
pNode = prule2->topRule->children;
}
return prule2;
return get_part_rule1(rel, pid2, bExistError, bMustExist, pSearch,
pNode, pstrdup(prule2->relname), &pNode2);
}
if (pid->idtype == AT_AP_IDList)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册