From b451c31c4ce8feb4b5db5ca2ef425ccce9af7ece Mon Sep 17 00:00:00 2001 From: Jelte Fennema Date: Fri, 21 Feb 2020 10:16:01 +0100 Subject: [PATCH] Semmle: Fix obvious issues (#3502) Fixes some obvious issues found by the Semmle static analysis tool. (cherry picked from commit 00d667c41d78467989bcd4f933e45d11139cca63) --- src/backend/distributed/deparser/deparse_type_stmts.c | 2 +- src/backend/distributed/master/master_stage_protocol.c | 2 +- src/include/distributed/function_utils.h | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/backend/distributed/deparser/deparse_type_stmts.c b/src/backend/distributed/deparser/deparse_type_stmts.c index 16a69f147..9e37d445e 100644 --- a/src/backend/distributed/deparser/deparse_type_stmts.c +++ b/src/backend/distributed/deparser/deparse_type_stmts.c @@ -137,7 +137,7 @@ AppendAlterTypeStmt(StringInfo buf, AlterTableStmt *stmt) stmt->relation->relname); ListCell *cmdCell = NULL; - Assert(stmt->relkind = OBJECT_TYPE); + Assert(stmt->relkind == OBJECT_TYPE); appendStringInfo(buf, "ALTER TYPE %s", identifier); foreach(cmdCell, stmt->cmds) diff --git a/src/backend/distributed/master/master_stage_protocol.c b/src/backend/distributed/master/master_stage_protocol.c index 819f16b15..7f4e8421e 100644 --- a/src/backend/distributed/master/master_stage_protocol.c +++ b/src/backend/distributed/master/master_stage_protocol.c @@ -123,7 +123,7 @@ master_create_empty_shard(PG_FUNCTION_ARGS) */ if (relationKind == RELKIND_FOREIGN_TABLE) { - bool cstoreTable = cstoreTable = CStoreTable(relationId); + bool cstoreTable = CStoreTable(relationId); if (cstoreTable) { storageType = SHARD_STORAGE_COLUMNAR; diff --git a/src/include/distributed/function_utils.h b/src/include/distributed/function_utils.h index 200037e23..d1256d100 100644 --- a/src/include/distributed/function_utils.h +++ b/src/include/distributed/function_utils.h @@ -7,6 +7,10 @@ *------------------------------------------------------------------------- */ +#ifndef CITUS_FUNCTION_UTILS_H +#define CITUS_FUNCTION_UTILS_H + +#include "postgres.h" #include "nodes/execnodes.h" @@ -18,3 +22,5 @@ extern Oid FunctionOidExtended(const char *schemaName, const char *functionName, argumentCount, bool missingOK); extern ReturnSetInfo * FunctionCallGetTupleStore1(PGFunction function, Oid functionId, Datum argument); + +#endif /* CITUS_FUNCTION_UTILS_H */