diff options
author | Nirbhay Choubey <nirbhay@mariadb.com> | 2016-06-23 12:54:38 -0400 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2016-06-23 12:54:38 -0400 |
commit | ecdb2b6e86d4bef2718eaec61f1edd1c11e41e1a (patch) | |
tree | 010cc373543ab2e65c63b9e1e56a62252afa3c50 /sql/item_cmpfunc.cc | |
parent | 51a32ebeb3653bfed481a3ddbfe5f93aecdf4a35 (diff) | |
parent | 12ae840375fe30da1c23647facaa0678858d6d92 (diff) | |
download | mariadb-git-ecdb2b6e86d4bef2718eaec61f1edd1c11e41e1a.tar.gz |
Merge tag 'mariadb-5.5.50' into 5.5-galeramariadb-galera-5.5.50
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index fb75c9af794..3bd0b5b3fa2 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -160,10 +160,11 @@ static int cmp_row_type(Item* item1, Item* item2) static int agg_cmp_type(Item_result *type, Item **items, uint nitems) { - uint i; + uint unsigned_count= items[0]->unsigned_flag; type[0]= items[0]->cmp_type(); - for (i= 1 ; i < nitems ; i++) + for (uint i= 1 ; i < nitems ; i++) { + unsigned_count+= items[i]->unsigned_flag; type[0]= item_cmp_type(type[0], items[i]->cmp_type()); /* When aggregating types of two row expressions we have to check @@ -175,6 +176,12 @@ static int agg_cmp_type(Item_result *type, Item **items, uint nitems) if (type[0] == ROW_RESULT && cmp_row_type(items[0], items[i])) return 1; // error found: invalid usage of rows } + /** + If all arguments are of INT type but have different unsigned_flag values, + switch to DECIMAL_RESULT. + */ + if (type[0] == INT_RESULT && unsigned_count != nitems && unsigned_count != 0) + type[0]= DECIMAL_RESULT; return 0; } |