Code

analyzer: The left operand of IN may be an array as well.
authorSebastian Harl <sh@tokkee.org>
Sun, 1 Mar 2015 15:22:09 +0000 (16:22 +0100)
committerSebastian Harl <sh@tokkee.org>
Sun, 1 Mar 2015 15:22:09 +0000 (16:22 +0100)
src/frontend/analyzer.c

index e9e1d138c80c9bd5177caa7f4d38b02f30a173b3..4e29fdf85fb956312466d50b514e3bae984fb135 100644 (file)
@@ -256,19 +256,14 @@ analyze_matcher(int context, sdb_store_matcher_t *m, sdb_strbuf_t *errbuf)
                        if (analyze_expr(context, CMP_M(m)->right, errbuf))
                                return -1;
 
-                       if ((CMP_M(m)->left->data_type > 0)
-                                       && (CMP_M(m)->left->data_type & SDB_TYPE_ARRAY)) {
-                               cmp_error(errbuf, m->type, CMP_M(m)->left->data_type,
-                                               CMP_M(m)->right->data_type);
-                               return -1;
-                       }
+                       /* the left operand may be a scalar or an array but the element
+                        * type has to match */
                        if ((CMP_M(m)->right->data_type > 0)
                                        && (! (CMP_M(m)->right->data_type & SDB_TYPE_ARRAY))) {
                                cmp_error(errbuf, m->type, CMP_M(m)->left->data_type,
                                                CMP_M(m)->right->data_type);
                                return -1;
                        }
-
                        if ((CMP_M(m)->left->data_type > 0)
                                        && (CMP_M(m)->right->data_type > 0)) {
                                if ((CMP_M(m)->left->data_type & 0xff)