diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index 50e4077343a9209c74c421e033f55a3003296215..7c232f8d2560e16e556927b9ac33364796cd6ee9 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -1386,6 +1386,7 @@ command_no_begin(const char *query)
 			return true;
 		if (wordlen == 10 && pg_strncasecmp(query, "tablespace", 10) == 0)
 			return true;
+		return false;
 	}
 
 	/* DISCARD ALL isn't allowed in xacts, but other variants are allowed. */
@@ -1401,6 +1402,7 @@ command_no_begin(const char *query)
 
 		if (wordlen == 3 && pg_strncasecmp(query, "all", 3) == 0)
 			return true;
+		return false;
 	}
 
 	return false;