Semmle: Actively check one possible NULL deref case (#3560)

Calling ErrorIfUnsupportedConstraint was still giving errors on Semmle. This
makes sure that we check for NULL at runtime. This way we can safely ignore all
errors created by this function.

(cherry picked from commit e0bbe1ca38)
pull/3647/head
Jelte Fennema 2020-03-11 18:11:56 +01:00
parent e4e0c65203
commit 20782c5ff5
1 changed files with 5 additions and 1 deletions

View File

@ -884,7 +884,11 @@ ErrorIfUnsupportedConstraint(Relation relation, char distributionMethod,
return; return;
} }
Assert(distributionColumn != NULL); if (distributionColumn == NULL)
{
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("distribution column of distributed table is NULL")));
}
char *relationName = RelationGetRelationName(relation); char *relationName = RelationGetRelationName(relation);
List *indexOidList = RelationGetIndexList(relation); List *indexOidList = RelationGetIndexList(relation);