From 20782c5ff58f7d8bae3a2dac0be85d43af10eb89 Mon Sep 17 00:00:00 2001 From: Jelte Fennema Date: Wed, 11 Mar 2020 18:11:56 +0100 Subject: [PATCH] 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 e0bbe1ca38a8659bda551f175df32b2321ab158e) --- src/backend/distributed/commands/table.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backend/distributed/commands/table.c b/src/backend/distributed/commands/table.c index ea2f4865f..b01d6d9c7 100644 --- a/src/backend/distributed/commands/table.c +++ b/src/backend/distributed/commands/table.c @@ -884,7 +884,11 @@ ErrorIfUnsupportedConstraint(Relation relation, char distributionMethod, 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); List *indexOidList = RelationGetIndexList(relation);