From f158e87159c96f9ef1a7fd15f3688dbdc2c4edb2 Mon Sep 17 00:00:00 2001 From: jingxiaobing Date: Fri, 10 Aug 2018 15:42:59 +0800 Subject: [PATCH] fix bug: HAVING field check --- .gitignore | 1 + plugins/shard/sharding-parser.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 84edc21..740b12e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ tests/ TAGS edeProject.el core +.cquery_cached_index/ # gtags file GTAGS diff --git a/plugins/shard/sharding-parser.c b/plugins/shard/sharding-parser.c index 0549a9f..8b8d761 100644 --- a/plugins/shard/sharding-parser.c +++ b/plugins/shard/sharding-parser.c @@ -1670,6 +1670,9 @@ select_check_HAVING_column(sql_select_t *select) gboolean found = FALSE; /* found having cond in columns */ int num_aggregate = 0; const char *having_func = having->left->token_text; + if (!having_func) { + return FALSE; + } sql_expr_list_t *columns = select->columns; int i; for (i = 0; columns && i < columns->len; ++i) {