Commit fb27ce22 authored by Sergei Golubchik's avatar Sergei Golubchik

5.3 merge

parents e2a99f18 5a21dc7d
...@@ -94,7 +94,7 @@ INSERT INTO t1 VALUES (1),(2); ...@@ -94,7 +94,7 @@ INSERT INTO t1 VALUES (1),(2);
INSERT INTO t2 VALUES (1),(2); INSERT INTO t2 VALUES (1),(2);
SET SESSION debug_dbug="+d,bug11747970_raise_error"; SET SESSION debug_dbug="+d,bug11747970_raise_error";
INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1); INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1);
ERROR HY000: Unknown error ERROR 70100: Query execution was interrupted
SET SESSION debug_dbug = DEFAULT; SET SESSION debug_dbug = DEFAULT;
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
......
...@@ -264,6 +264,13 @@ INET_NTOA(0) ...@@ -264,6 +264,13 @@ INET_NTOA(0)
SELECT '1' IN ('1', INET_NTOA(0)); SELECT '1' IN ('1', INET_NTOA(0));
'1' IN ('1', INET_NTOA(0)) '1' IN ('1', INET_NTOA(0))
1 1
SELECT NAME_CONST('a', -(1 OR 2)) OR 1;
ERROR HY000: Incorrect arguments to NAME_CONST
SELECT NAME_CONST('a', -(1 AND 2)) AND 1;
ERROR HY000: Incorrect arguments to NAME_CONST
SELECT NAME_CONST('a', -(1)) OR 1;
NAME_CONST('a', -(1)) OR 1
1
# #
# Bug #52165: Assertion failed: file .\dtoa.c, line 465 # Bug #52165: Assertion failed: file .\dtoa.c, line 465
# #
...@@ -340,6 +347,3 @@ drop table t1,tv; ...@@ -340,6 +347,3 @@ drop table t1,tv;
# #
# End of 5.5 tests # End of 5.5 tests
# #
#
# End of tests
#
create table t1 (i tinyint);
set debug_dbug='+d,bug11747970_raise_error';
insert into t1 (i) select i from t1 union select i from t1;
ERROR 70100: Query execution was interrupted
drop table t1;
...@@ -60,6 +60,7 @@ sub searchd_start { ...@@ -60,6 +60,7 @@ sub searchd_start {
my ($sphinx, $test) = @_; # My::Config::Group, My::Test my ($sphinx, $test) = @_; # My::Config::Group, My::Test
return unless $exe_sphinx_indexer and $exe_sphinx_searchd; return unless $exe_sphinx_indexer and $exe_sphinx_searchd;
return if $sphinx->{proc}; # Already started
# First we must run the indexer to create the data. # First we must run the indexer to create the data.
my $sphinx_data_dir= "$::opt_vardir/" . $sphinx->name(); my $sphinx_data_dir= "$::opt_vardir/" . $sphinx->name();
......
create table ts (id bigint unsigned not null, w int not null, query varchar(255) not null, index(query)) engine=sphinx connection="sphinx://127.0.0.1:PORT/*";
SELECT a.* FROM (SELECT * FROM ts si WHERE si.query=';mode=extended2;limit=1000000;maxmatches=500') AS a UNION SELECT b.* FROM (SELECT * FROM ts si WHERE si.query='@* 123nothingtofind123;mode=extended2;limit=1000000;maxmatches=500') AS b;
id w query
SELECT a.* FROM (SELECT * FROM ts si WHERE si.query='@* 123nothingtofind123;mode=extended2;limit=1000000;maxmatches=500') AS a UNION SELECT b.* FROM (SELECT * FROM ts si WHERE si.query=';mode=extended2;limit=1000000;maxmatches=500') AS b;
id w query
1 1 ;mode=extended2;limit=1000000;maxmatches=500
2 1 ;mode=extended2;limit=1000000;maxmatches=500
3 1 ;mode=extended2;limit=1000000;maxmatches=500
4 1 ;mode=extended2;limit=1000000;maxmatches=500
drop table ts;
#
# MDEV-5539 Empty results in UNION with Sphinx engine
#
--replace_result $SPHINXSEARCH_PORT PORT
eval create table ts (id bigint unsigned not null, w int not null, query varchar(255) not null, index(query)) engine=sphinx connection="sphinx://127.0.0.1:$SPHINXSEARCH_PORT/*";
let $q1=SELECT * FROM ts si WHERE si.query=';mode=extended2;limit=1000000;maxmatches=500';
let $q2=SELECT * FROM ts si WHERE si.query='@* 123nothingtofind123;mode=extended2;limit=1000000;maxmatches=500';
########################
# BUG BUG BUG !!!
# Note, the result below is incorrect! It should be updated when
# MDEV-5539 is fixed upstream!!!
########################
eval SELECT a.* FROM ($q1) AS a UNION SELECT b.* FROM ($q2) AS b;
eval SELECT a.* FROM ($q2) AS a UNION SELECT b.* FROM ($q1) AS b;
drop table ts;
...@@ -103,7 +103,7 @@ CREATE TABLE t2(f1 INT); ...@@ -103,7 +103,7 @@ CREATE TABLE t2(f1 INT);
INSERT INTO t1 VALUES (1),(2); INSERT INTO t1 VALUES (1),(2);
INSERT INTO t2 VALUES (1),(2); INSERT INTO t2 VALUES (1),(2);
SET SESSION debug_dbug="+d,bug11747970_raise_error"; SET SESSION debug_dbug="+d,bug11747970_raise_error";
--error 1105 --error ER_QUERY_INTERRUPTED
INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1); INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1);
SET SESSION debug_dbug = DEFAULT; SET SESSION debug_dbug = DEFAULT;
DROP TABLE t1,t2; DROP TABLE t1,t2;
......
...@@ -298,6 +298,14 @@ DROP TABLE t1; ...@@ -298,6 +298,14 @@ DROP TABLE t1;
SELECT INET_NTOA(0); SELECT INET_NTOA(0);
SELECT '1' IN ('1', INET_NTOA(0)); SELECT '1' IN ('1', INET_NTOA(0));
#
# MDEV-5655 Server crashes on NAME_CONST containing AND/OR expressions
#
--error ER_WRONG_ARGUMENTS
SELECT NAME_CONST('a', -(1 OR 2)) OR 1;
--error ER_WRONG_ARGUMENTS
SELECT NAME_CONST('a', -(1 AND 2)) AND 1;
SELECT NAME_CONST('a', -(1)) OR 1;
--echo # --echo #
--echo # Bug #52165: Assertion failed: file .\dtoa.c, line 465 --echo # Bug #52165: Assertion failed: file .\dtoa.c, line 465
...@@ -372,6 +380,3 @@ drop table t1,tv; ...@@ -372,6 +380,3 @@ drop table t1,tv;
--echo # End of 5.5 tests --echo # End of 5.5 tests
--echo # --echo #
--echo #
--echo # End of tests
--echo #
#
# MDEV-714 LP:1020645 - crash (sig 11) with union query
#
--source include/have_debug.inc
create table t1 (i tinyint);
set debug_dbug='+d,bug11747970_raise_error';
--error ER_QUERY_INTERRUPTED
insert into t1 (i) select i from t1 union select i from t1;
drop table t1;
...@@ -1677,17 +1677,28 @@ bool Item_name_const::is_null() ...@@ -1677,17 +1677,28 @@ bool Item_name_const::is_null()
Item_name_const::Item_name_const(Item *name_arg, Item *val): Item_name_const::Item_name_const(Item *name_arg, Item *val):
value_item(val), name_item(name_arg) value_item(val), name_item(name_arg)
{ {
if (!(valid_args= name_item->basic_const_item() &&
(value_item->basic_const_item() ||
((value_item->type() == FUNC_ITEM) &&
((((Item_func *) value_item)->functype() ==
Item_func::COLLATE_FUNC) ||
((((Item_func *) value_item)->functype() ==
Item_func::NEG_FUNC) &&
(((Item_func *) value_item)->key_item()->type() !=
FUNC_ITEM)))))))
my_error(ER_WRONG_ARGUMENTS, MYF(0), "NAME_CONST");
Item::maybe_null= TRUE; Item::maybe_null= TRUE;
valid_args= true;
if (!name_item->basic_const_item())
goto err;
if (value_item->basic_const_item())
return; // ok
if (value_item->type() == FUNC_ITEM)
{
Item_func *value_func= (Item_func *) value_item;
if (value_func->functype() != Item_func::COLLATE_FUNC &&
value_func->functype() != Item_func::NEG_FUNC)
goto err;
if (value_func->key_item()->basic_const_item())
return; // ok
}
err:
valid_args= false;
my_error(ER_WRONG_ARGUMENTS, MYF(0), "NAME_CONST");
} }
......
...@@ -2883,7 +2883,7 @@ subselect_single_select_engine(THD *thd_arg, st_select_lex *select, ...@@ -2883,7 +2883,7 @@ subselect_single_select_engine(THD *thd_arg, st_select_lex *select,
select_result_interceptor *result_arg, select_result_interceptor *result_arg,
Item_subselect *item_arg) Item_subselect *item_arg)
:subselect_engine(thd_arg, item_arg, result_arg), :subselect_engine(thd_arg, item_arg, result_arg),
prepared(0), executed(0), optimize_error(0), prepared(0), executed(0),
select_lex(select), join(0) select_lex(select), join(0)
{ {
select_lex->master_unit()->item= item_arg; select_lex->master_unit()->item= item_arg;
...@@ -2897,7 +2897,7 @@ int subselect_single_select_engine::get_identifier() ...@@ -2897,7 +2897,7 @@ int subselect_single_select_engine::get_identifier()
void subselect_single_select_engine::cleanup() void subselect_single_select_engine::cleanup()
{ {
DBUG_ENTER("subselect_single_select_engine::cleanup"); DBUG_ENTER("subselect_single_select_engine::cleanup");
prepared= executed= optimize_error= 0; prepared= executed= 0;
join= 0; join= 0;
result->cleanup(); result->cleanup();
select_lex->uncacheable&= ~UNCACHEABLE_DEPENDENT_INJECTED; select_lex->uncacheable&= ~UNCACHEABLE_DEPENDENT_INJECTED;
...@@ -3131,9 +3131,6 @@ int subselect_single_select_engine::exec() ...@@ -3131,9 +3131,6 @@ int subselect_single_select_engine::exec()
{ {
DBUG_ENTER("subselect_single_select_engine::exec"); DBUG_ENTER("subselect_single_select_engine::exec");
if (optimize_error)
DBUG_RETURN(1);
char const *save_where= thd->where; char const *save_where= thd->where;
SELECT_LEX *save_select= thd->lex->current_select; SELECT_LEX *save_select= thd->lex->current_select;
thd->lex->current_select= select_lex; thd->lex->current_select= select_lex;
...@@ -3146,7 +3143,7 @@ int subselect_single_select_engine::exec() ...@@ -3146,7 +3143,7 @@ int subselect_single_select_engine::exec()
if (join->optimize()) if (join->optimize())
{ {
thd->where= save_where; thd->where= save_where;
executed= optimize_error= 1; executed= 1;
thd->lex->current_select= save_select; thd->lex->current_select= save_select;
DBUG_RETURN(join->error ? join->error : 1); DBUG_RETURN(join->error ? join->error : 1);
} }
......
...@@ -780,7 +780,6 @@ class subselect_single_select_engine: public subselect_engine ...@@ -780,7 +780,6 @@ class subselect_single_select_engine: public subselect_engine
{ {
bool prepared; /* simple subselect is prepared */ bool prepared; /* simple subselect is prepared */
bool executed; /* simple subselect is executed */ bool executed; /* simple subselect is executed */
bool optimize_error; /* simple subselect optimization failed */
st_select_lex *select_lex; /* corresponding select_lex */ st_select_lex *select_lex; /* corresponding select_lex */
JOIN * join; /* corresponding JOIN structure */ JOIN * join; /* corresponding JOIN structure */
public: public:
......
...@@ -129,7 +129,6 @@ void one_thread_scheduler(scheduler_functions *func) ...@@ -129,7 +129,6 @@ void one_thread_scheduler(scheduler_functions *func)
{ {
scheduler_init(); scheduler_init();
func->max_threads= 1; func->max_threads= 1;
//max_connections= 1;
func->max_connections= &max_connections; func->max_connections= &max_connections;
func->connection_count= &connection_count; func->connection_count= &connection_count;
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
......
...@@ -3214,13 +3214,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list, ...@@ -3214,13 +3214,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
#endif #endif
DBUG_EXECUTE_IF("bug11747970_raise_error", DBUG_EXECUTE_IF("bug11747970_raise_error",
{ { join->thd->killed= KILL_QUERY_HARD; });
if (!error)
{
my_error(ER_UNKNOWN_ERROR, MYF(0));
goto error;
}
});
if (error) if (error)
{ {
table->file->print_error(error, MYF(0)); table->file->print_error(error, MYF(0));
......
...@@ -639,7 +639,8 @@ bool st_select_lex_unit::exec() ...@@ -639,7 +639,8 @@ bool st_select_lex_unit::exec()
if (!(uncacheable & ~UNCACHEABLE_EXPLAIN) && item) if (!(uncacheable & ~UNCACHEABLE_EXPLAIN) && item)
item->make_const(); item->make_const();
saved_error= optimize(); if ((saved_error= optimize()))
DBUG_RETURN(saved_error);
if (uncacheable || !item || !item->assigned() || describe) if (uncacheable || !item || !item->assigned() || describe)
{ {
......
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