Commit ba1b5eb4 authored by Georgi Kodinov's avatar Georgi Kodinov

merged bug 43354 to 5.1-bugteam

parents 16d7c26b d3d6f4fd
...@@ -155,6 +155,10 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -155,6 +155,10 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings: Warnings:
Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1` Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
DROP TABLE t1,t2; DROP TABLE t1,t2;
CREATE TABLE t1 (a INT PRIMARY KEY);
EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a);
ERROR 42000: Key 'a' doesn't exist in table 't1'
DROP TABLE t1;
# #
# Bug#37870: Usage of uninitialized value caused failed assertion. # Bug#37870: Usage of uninitialized value caused failed assertion.
# #
...@@ -182,3 +186,4 @@ dt ...@@ -182,3 +186,4 @@ dt
2001-01-01 01:01:01 2001-01-01 01:01:01
2001-01-01 01:01:01 2001-01-01 01:01:01
drop tables t1, t2; drop tables t1, t2;
End of 5.1 tests.
...@@ -123,6 +123,21 @@ execute s1; ...@@ -123,6 +123,21 @@ execute s1;
DROP TABLE t1,t2; DROP TABLE t1,t2;
#
# Bug #43354: Use key hint can crash server in explain extended query
#
CREATE TABLE t1 (a INT PRIMARY KEY);
--error ER_KEY_DOES_NOT_EXITS
EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a);
DROP TABLE t1;
# End of 5.0 tests.
--echo # --echo #
--echo # Bug#37870: Usage of uninitialized value caused failed assertion. --echo # Bug#37870: Usage of uninitialized value caused failed assertion.
--echo # --echo #
...@@ -141,4 +156,4 @@ flush tables; ...@@ -141,4 +156,4 @@ flush tables;
SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' ); SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' );
drop tables t1, t2; drop tables t1, t2;
# End of 5.0 tests. --echo End of 5.1 tests.
...@@ -439,7 +439,8 @@ void Item_sum::make_field(Send_field *tmp_field) ...@@ -439,7 +439,8 @@ void Item_sum::make_field(Send_field *tmp_field)
void Item_sum::print(String *str, enum_query_type query_type) void Item_sum::print(String *str, enum_query_type query_type)
{ {
Item **pargs= orig_args; /* orig_args is not filled with valid values until fix_fields() */
Item **pargs= fixed ? orig_args : args;
str->append(func_name()); str->append(func_name());
for (uint i=0 ; i < arg_count ; i++) for (uint i=0 ; i < arg_count ; i++)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment