Fix statical analysis findings (#5550)

pull/5564/head
Hanefi Onaldi 2021-12-22 18:16:11 +03:00 committed by GitHub
parent d5a969b055
commit 1af8ca8f7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -1190,7 +1190,7 @@ CreateDistributedTableLike(TableConversionState *con)
* at this moment, but that's going to be the table in pg_dist_partition.
*/
Oid parentRelationId = PartitionParentOid(originalRelationId);
Var *parentDistKey = DistPartitionKey(parentRelationId);
Var *parentDistKey = DistPartitionKeyOrError(parentRelationId);
char *parentDistKeyColumnName =
ColumnToColumnName(parentRelationId, nodeToString(parentDistKey));

View File

@ -4353,6 +4353,13 @@ GetIntervalTypeInfo(char partitionMethod, Var *partitionColumn,
case DISTRIBUTE_BY_APPEND:
case DISTRIBUTE_BY_RANGE:
{
/* we need a valid partition column Var in this case */
if (partitionColumn == NULL)
{
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("unexpected partition column value: null"),
errdetail("Please report this to the Citus core team.")));
}
*intervalTypeId = partitionColumn->vartype;
*intervalTypeMod = partitionColumn->vartypmod;
break;