Test that the left and right sides of a compound SELECT operator have the same  number of expressions in the expanded expression list before beginning to generate code.

FossilOrigin-Name: 4df852ce26c95d5d23c83dbe9c59d2c3435acddf
diff --git a/src/resolve.c b/src/resolve.c
index 27eba9f..fd57fd7 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -1331,6 +1331,13 @@
       }
     }
 
+    /* If this is part of a compound SELECT, check that it has the right
+    ** number of expressions in the select list. */
+    if( p->pNext && p->pEList->nExpr!=p->pNext->pEList->nExpr ){
+      sqlite3SelectWrongNumTermsError(pParse, p->pNext);
+      return WRC_Abort;
+    }
+
     /* Advance to the next term of the compound
     */
     p = p->pPrior;