From f8a7e8a2be143adf5a29b7a8042b0502a96bedff Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Mon, 7 Nov 2016 09:12:39 +0100 Subject: [PATCH] Fix assertions which have accidental side effects Asserting that an assignment isn't zero is a valid use of Assert(), but these instances look more like accidental assignments due to a missing '='. getgpsegmentCount() is already internally asserting that the count is > 0 so we would never reach here in case it was. --- src/backend/cdb/dispatcher/cdbgang.c | 2 +- src/backend/tcop/utility.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/cdb/dispatcher/cdbgang.c b/src/backend/cdb/dispatcher/cdbgang.c index b410ac4a0c..c3beae3fa9 100644 --- a/src/backend/cdb/dispatcher/cdbgang.c +++ b/src/backend/cdb/dispatcher/cdbgang.c @@ -289,7 +289,7 @@ isPrimaryWriterGangAlive(void) int size = primaryWriterGang->size; int i = 0; - Assert(size = getgpsegmentCount()); + Assert(size == getgpsegmentCount()); for (i = 0; i < size; i++) { diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index 8a6df6a4da..ec046b9f05 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -942,7 +942,7 @@ ProcessUtility(Node *parsetree, { case RELKIND_VIEW: case RELKIND_COMPOSITE_TYPE: - Assert(relStorage = RELSTORAGE_VIRTUAL); + Assert(relStorage == RELSTORAGE_VIRTUAL); break; default: Assert(relStorage == RELSTORAGE_HEAP || -- GitLab