From b27fb1b6975faa490b9f7b54f9f5168a0122e045 Mon Sep 17 00:00:00 2001 From: Nicolas Tsiftes Date: Wed, 7 Aug 2013 10:43:13 +0200 Subject: [PATCH] Prevent erroneous index creation for non-numerical attributes. --- apps/antelope/index.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/antelope/index.c b/apps/antelope/index.c index 0972c48b0..0a7e53dc1 100644 --- a/apps/antelope/index.c +++ b/apps/antelope/index.c @@ -91,6 +91,11 @@ index_create(index_type_t index_type, relation_t *rel, attribute_t *attr) return DB_STORAGE_ERROR; } + if(attr->domain != DOMAIN_INT && attr->domain != DOMAIN_LONG) { + PRINTF("DB: Cannot create an index for a non-number attribute!\n"); + return DB_INDEX_ERROR; + } + api = find_index_api(index_type); if(api == NULL) { PRINTF("DB: No API for index type %d\n", (int)index_type);