mirror of
https://github.com/MariaDB/server.git
synced 2025-01-28 01:34:17 +01:00
5.3 merge
This commit is contained in:
commit
fb27ce22f7
15 changed files with 85 additions and 34 deletions
|
@ -94,7 +94,7 @@ INSERT INTO t1 VALUES (1),(2);
|
|||
INSERT INTO t2 VALUES (1),(2);
|
||||
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);
|
||||
ERROR HY000: Unknown error
|
||||
ERROR 70100: Query execution was interrupted
|
||||
SET SESSION debug_dbug = DEFAULT;
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
|
|
|
@ -264,6 +264,13 @@ INET_NTOA(0)
|
|||
SELECT '1' IN ('1', INET_NTOA(0));
|
||||
'1' IN ('1', INET_NTOA(0))
|
||||
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
|
||||
#
|
||||
|
@ -340,6 +347,3 @@ drop table t1,tv;
|
|||
#
|
||||
# End of 5.5 tests
|
||||
#
|
||||
#
|
||||
# End of tests
|
||||
#
|
||||
|
|
5
mysql-test/r/union_crash-714.result
Normal file
5
mysql-test/r/union_crash-714.result
Normal file
|
@ -0,0 +1,5 @@
|
|||
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 {
|
|||
my ($sphinx, $test) = @_; # My::Config::Group, My::Test
|
||||
|
||||
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.
|
||||
my $sphinx_data_dir= "$::opt_vardir/" . $sphinx->name();
|
||||
|
|
10
mysql-test/suite/sphinx/union-5539.result
Normal file
10
mysql-test/suite/sphinx/union-5539.result
Normal file
|
@ -0,0 +1,10 @@
|
|||
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;
|
16
mysql-test/suite/sphinx/union-5539.test
Normal file
16
mysql-test/suite/sphinx/union-5539.test
Normal file
|
@ -0,0 +1,16 @@
|
|||
#
|
||||
# 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);
|
|||
INSERT INTO t1 VALUES (1),(2);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
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);
|
||||
SET SESSION debug_dbug = DEFAULT;
|
||||
DROP TABLE t1,t2;
|
||||
|
|
|
@ -298,6 +298,14 @@ DROP TABLE t1;
|
|||
SELECT 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 # Bug #52165: Assertion failed: file .\dtoa.c, line 465
|
||||
|
@ -372,6 +380,3 @@ drop table t1,tv;
|
|||
--echo # End of 5.5 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # End of tests
|
||||
--echo #
|
||||
|
|
9
mysql-test/t/union_crash-714.test
Normal file
9
mysql-test/t/union_crash-714.test
Normal file
|
@ -0,0 +1,9 @@
|
|||
#
|
||||
# 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;
|
31
sql/item.cc
31
sql/item.cc
|
@ -1677,17 +1677,28 @@ bool Item_name_const::is_null()
|
|||
Item_name_const::Item_name_const(Item *name_arg, Item *val):
|
||||
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;
|
||||
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,
|
|||
select_result_interceptor *result_arg,
|
||||
Item_subselect *item_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->master_unit()->item= item_arg;
|
||||
|
@ -2897,7 +2897,7 @@ int subselect_single_select_engine::get_identifier()
|
|||
void subselect_single_select_engine::cleanup()
|
||||
{
|
||||
DBUG_ENTER("subselect_single_select_engine::cleanup");
|
||||
prepared= executed= optimize_error= 0;
|
||||
prepared= executed= 0;
|
||||
join= 0;
|
||||
result->cleanup();
|
||||
select_lex->uncacheable&= ~UNCACHEABLE_DEPENDENT_INJECTED;
|
||||
|
@ -3131,9 +3131,6 @@ int subselect_single_select_engine::exec()
|
|||
{
|
||||
DBUG_ENTER("subselect_single_select_engine::exec");
|
||||
|
||||
if (optimize_error)
|
||||
DBUG_RETURN(1);
|
||||
|
||||
char const *save_where= thd->where;
|
||||
SELECT_LEX *save_select= thd->lex->current_select;
|
||||
thd->lex->current_select= select_lex;
|
||||
|
@ -3146,7 +3143,7 @@ int subselect_single_select_engine::exec()
|
|||
if (join->optimize())
|
||||
{
|
||||
thd->where= save_where;
|
||||
executed= optimize_error= 1;
|
||||
executed= 1;
|
||||
thd->lex->current_select= save_select;
|
||||
DBUG_RETURN(join->error ? join->error : 1);
|
||||
}
|
||||
|
|
|
@ -780,7 +780,6 @@ class subselect_single_select_engine: public subselect_engine
|
|||
{
|
||||
bool prepared; /* simple subselect is prepared */
|
||||
bool executed; /* simple subselect is executed */
|
||||
bool optimize_error; /* simple subselect optimization failed */
|
||||
st_select_lex *select_lex; /* corresponding select_lex */
|
||||
JOIN * join; /* corresponding JOIN structure */
|
||||
public:
|
||||
|
|
|
@ -129,7 +129,6 @@ void one_thread_scheduler(scheduler_functions *func)
|
|||
{
|
||||
scheduler_init();
|
||||
func->max_threads= 1;
|
||||
//max_connections= 1;
|
||||
func->max_connections= &max_connections;
|
||||
func->connection_count= &connection_count;
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
|
|
|
@ -3214,13 +3214,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
|
|||
#endif
|
||||
|
||||
DBUG_EXECUTE_IF("bug11747970_raise_error",
|
||||
{
|
||||
if (!error)
|
||||
{
|
||||
my_error(ER_UNKNOWN_ERROR, MYF(0));
|
||||
goto error;
|
||||
}
|
||||
});
|
||||
{ join->thd->killed= KILL_QUERY_HARD; });
|
||||
if (error)
|
||||
{
|
||||
table->file->print_error(error, MYF(0));
|
||||
|
|
|
@ -639,7 +639,8 @@ bool st_select_lex_unit::exec()
|
|||
if (!(uncacheable & ~UNCACHEABLE_EXPLAIN) && item)
|
||||
item->make_const();
|
||||
|
||||
saved_error= optimize();
|
||||
if ((saved_error= optimize()))
|
||||
DBUG_RETURN(saved_error);
|
||||
|
||||
if (uncacheable || !item || !item->assigned() || describe)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue