From 528df1df4537fcf4ac12d3408645d04298af85c1 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 12 Feb 2014 17:07:05 +0200 Subject: [PATCH] MDEV-5505: Assertion `! is_set()' fails on PREPARE SELECT with out of range in GROUP BY Fixed error processing in find_order_in_list(): if an error reported to user there is no sens to continue. --- mysql-test/r/ps.result | 11 +++++++++++ mysql-test/t/ps.test | 15 +++++++++++++++ sql/sql_select.cc | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 70fc9177cfc..1438595aa3b 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -4041,3 +4041,14 @@ DEALLOCATE PREPARE stmt; DROP VIEW v2; DROP TABLE t1, t2; # End of 5.3 tests +# +# MDEV-5505: Assertion `! is_set()' fails on PREPARE SELECT +# with out of range in GROUP BY +# +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1"; +ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 + 1)' +SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1; +ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 + 1)' +drop table t1; +# End of 5.3 tests diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 4200f7435fb..9775a8dc28e 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -3618,3 +3618,18 @@ DROP VIEW v2; DROP TABLE t1, t2; --echo # End of 5.3 tests + +--echo # +--echo # MDEV-5505: Assertion `! is_set()' fails on PREPARE SELECT +--echo # with out of range in GROUP BY +--echo # +CREATE TABLE t1 (a INT); + +--error ER_DATA_OUT_OF_RANGE +PREPARE stmt FROM "SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1"; +--error ER_DATA_OUT_OF_RANGE +SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1; + +drop table t1; + +--echo # End of 5.3 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 43ffb8bb084..a773eac1a32 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -20435,7 +20435,7 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, if (!order_item->fixed && (order_item->fix_fields(thd, order->item) || (order_item= *order->item)->check_cols(1) || - thd->is_fatal_error)) + thd->is_error())) return TRUE; /* Wrong field. */ uint el= all_fields.elements;