Fix for LP BUG#944504
Problem is that subquery execution can't be called during prepare/optimize phase. Also small fix for subquery test suite.
This commit is contained in:
parent
6f3c39a057
commit
8a5940c477
@ -267,3 +267,19 @@ drop table t1;
|
|||||||
create table t1(a char character set latin1 default _cp1251 0xFF);
|
create table t1(a char character set latin1 default _cp1251 0xFF);
|
||||||
ERROR 42000: Invalid default value for 'a'
|
ERROR 42000: Invalid default value for 'a'
|
||||||
End of 4.1 tests
|
End of 4.1 tests
|
||||||
|
SET CHARACTER SET DEFAULT;
|
||||||
|
#
|
||||||
|
# LP BUG#944504 Item_func_conv_charset tries to execute subquery constant
|
||||||
|
#
|
||||||
|
SET optimizer_switch = 'in_to_exists=on';
|
||||||
|
SET character_set_connection = utf8;
|
||||||
|
CREATE TABLE t1 ( a VARCHAR(1) );
|
||||||
|
INSERT INTO t1 VALUES ('m'),('n');
|
||||||
|
CREATE VIEW v1 AS SELECT 'w' ;
|
||||||
|
SELECT * FROM t1 WHERE a < ALL ( SELECT * FROM v1 );
|
||||||
|
ERROR HY000: Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation '<='
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
SET character_set_connection = default;
|
||||||
|
SET optimizer_switch= default;
|
||||||
|
#End of 5.3 tests
|
||||||
|
@ -5994,6 +5994,7 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
|
|||||||
1
|
1
|
||||||
NULL
|
NULL
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
|
set optimizer_switch=@subselect_tmp;
|
||||||
#
|
#
|
||||||
# LP BUG#905353 Wrong non-empty result with a constant table,
|
# LP BUG#905353 Wrong non-empty result with a constant table,
|
||||||
# aggregate function in subquery, MyISAM or Aria
|
# aggregate function in subquery, MyISAM or Aria
|
||||||
|
@ -5993,6 +5993,7 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
|
|||||||
1
|
1
|
||||||
NULL
|
NULL
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
|
set optimizer_switch=@subselect_tmp;
|
||||||
#
|
#
|
||||||
# LP BUG#905353 Wrong non-empty result with a constant table,
|
# LP BUG#905353 Wrong non-empty result with a constant table,
|
||||||
# aggregate function in subquery, MyISAM or Aria
|
# aggregate function in subquery, MyISAM or Aria
|
||||||
|
@ -5989,6 +5989,7 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
|
|||||||
1
|
1
|
||||||
NULL
|
NULL
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
|
set optimizer_switch=@subselect_tmp;
|
||||||
#
|
#
|
||||||
# LP BUG#905353 Wrong non-empty result with a constant table,
|
# LP BUG#905353 Wrong non-empty result with a constant table,
|
||||||
# aggregate function in subquery, MyISAM or Aria
|
# aggregate function in subquery, MyISAM or Aria
|
||||||
|
@ -6000,6 +6000,7 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
|
|||||||
1
|
1
|
||||||
NULL
|
NULL
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
|
set optimizer_switch=@subselect_tmp;
|
||||||
#
|
#
|
||||||
# LP BUG#905353 Wrong non-empty result with a constant table,
|
# LP BUG#905353 Wrong non-empty result with a constant table,
|
||||||
# aggregate function in subquery, MyISAM or Aria
|
# aggregate function in subquery, MyISAM or Aria
|
||||||
|
@ -5989,6 +5989,7 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
|
|||||||
1
|
1
|
||||||
NULL
|
NULL
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
|
set optimizer_switch=@subselect_tmp;
|
||||||
#
|
#
|
||||||
# LP BUG#905353 Wrong non-empty result with a constant table,
|
# LP BUG#905353 Wrong non-empty result with a constant table,
|
||||||
# aggregate function in subquery, MyISAM or Aria
|
# aggregate function in subquery, MyISAM or Aria
|
||||||
|
@ -210,3 +210,21 @@ drop table t1;
|
|||||||
create table t1(a char character set latin1 default _cp1251 0xFF);
|
create table t1(a char character set latin1 default _cp1251 0xFF);
|
||||||
|
|
||||||
--echo End of 4.1 tests
|
--echo End of 4.1 tests
|
||||||
|
|
||||||
|
SET CHARACTER SET DEFAULT;
|
||||||
|
--echo #
|
||||||
|
--echo # LP BUG#944504 Item_func_conv_charset tries to execute subquery constant
|
||||||
|
--echo #
|
||||||
|
SET optimizer_switch = 'in_to_exists=on';
|
||||||
|
SET character_set_connection = utf8;
|
||||||
|
CREATE TABLE t1 ( a VARCHAR(1) );
|
||||||
|
INSERT INTO t1 VALUES ('m'),('n');
|
||||||
|
CREATE VIEW v1 AS SELECT 'w' ;
|
||||||
|
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||||
|
SELECT * FROM t1 WHERE a < ALL ( SELECT * FROM v1 );
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
SET character_set_connection = default;
|
||||||
|
SET optimizer_switch= default;
|
||||||
|
|
||||||
|
--echo #End of 5.3 tests
|
||||||
|
@ -5075,8 +5075,8 @@ SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1;
|
|||||||
# example with "random"
|
# example with "random"
|
||||||
SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
|
SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
|
||||||
|
|
||||||
|
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
|
set optimizer_switch=@subselect_tmp;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # LP BUG#905353 Wrong non-empty result with a constant table,
|
--echo # LP BUG#905353 Wrong non-empty result with a constant table,
|
||||||
@ -5090,5 +5090,6 @@ SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 );
|
|||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
|
||||||
--echo # return optimizer switch changed in the beginning of this test
|
--echo # return optimizer switch changed in the beginning of this test
|
||||||
set optimizer_switch=@subselect_tmp;
|
set optimizer_switch=@subselect_tmp;
|
||||||
|
@ -747,7 +747,7 @@ public:
|
|||||||
{
|
{
|
||||||
DBUG_ASSERT(args[0]->fixed);
|
DBUG_ASSERT(args[0]->fixed);
|
||||||
conv_charset= cs;
|
conv_charset= cs;
|
||||||
if (cache_if_const && args[0]->const_item())
|
if (cache_if_const && args[0]->const_item() && !args[0]->with_subselect)
|
||||||
{
|
{
|
||||||
uint errors= 0;
|
uint errors= 0;
|
||||||
String tmp, *str= args[0]->val_str(&tmp);
|
String tmp, *str= args[0]->val_str(&tmp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user