From: Sebastian Harl Date: Sun, 9 Nov 2014 10:48:03 +0000 (+0100) Subject: data: Don't treat empty arrays (value = NULL) as NULL. X-Git-Tag: sysdb-0.6.0~15 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b50c58aac035dbb91b5bc85b579aa559d010dff4;p=sysdb.git data: Don't treat empty arrays (value = NULL) as NULL. Treating them as NULL leads to weird behavior when using ANY/ALL iterators. --- diff --git a/src/core/data.c b/src/core/data.c index a6cd092..a954b3d 100644 --- a/src/core/data.c +++ b/src/core/data.c @@ -607,8 +607,6 @@ sdb_data_isnull(const sdb_data_t *datum) return 1; if ((datum->type == SDB_TYPE_REGEX) && (! datum->data.re.raw)) return 1; - if ((datum->type & SDB_TYPE_ARRAY) && (! datum->data.array.values)) - return 1; return 0; } /* sdb_data_isnull */ diff --git a/t/unit/core/store_lookup_test.c b/t/unit/core/store_lookup_test.c index dcf72fa..4d968a6 100644 --- a/t/unit/core/store_lookup_test.c +++ b/t/unit/core/store_lookup_test.c @@ -532,6 +532,8 @@ START_TEST(test_scan) { "name =~ 'a|b'", NULL, 2 }, { "name =~ 'host'", NULL, 0 }, { "name =~ '.'", NULL, 3 }, + { "ANY backend = 'backend'", NULL, 0 }, + { "ALL backend = ''", NULL, 3 }, /* backend is empty */ { "ANY metric = 'm1'", NULL, 2 }, { "ANY metric= 'm1'", "name = 'x'", 0 }, /* filter never matches */ { "ANY metric = 'm1'",