mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge gleb.loc:/home/uchum/work/bk/mysql-5.0-opt
into gleb.loc:/home/uchum/work/bk/mysql-5.1-opt client/mysqldump.c: Auto merged mysql-test/r/join_outer.result: Auto merged mysql-test/r/kill.result: Auto merged mysql-test/r/view.result: Auto merged mysql-test/t/join_outer.test: Auto merged mysql-test/t/kill.test: Auto merged sql/field.h: Auto merged sql/item_func.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_base.cc: Auto merged mysql-test/r/mysqldump.result: Merge with 5.0-opt mysql-test/t/mysqldump.test: Merge with 5.0-opt mysql-test/t/view.test: Merge with 5.0-opt sql/sql_select.cc: Merge with 5.0-opt
This commit is contained in:
@ -2687,15 +2687,18 @@ static void dump_table(char *table, char *db)
|
||||
plus 2 bytes for '0x' prefix.
|
||||
- In non-HEX mode we need up to 2 bytes per character,
|
||||
plus 2 bytes for leading and trailing '\'' characters.
|
||||
Also we need to reserve 1 byte for terminating '\0'.
|
||||
*/
|
||||
dynstr_realloc_checked(&extended_row,length * 2+2);
|
||||
dynstr_realloc_checked(&extended_row,length * 2 + 2 + 1);
|
||||
if (opt_hex_blob && is_blob)
|
||||
{
|
||||
dynstr_append_checked(&extended_row, "0x");
|
||||
extended_row.length+= mysql_hex_string(extended_row.str +
|
||||
extended_row.length,
|
||||
row[i], length);
|
||||
extended_row.str[extended_row.length]= '\0';
|
||||
DBUG_ASSERT(extended_row.length+1 <= extended_row.max_length);
|
||||
/* mysql_hex_string() already terminated string by '\0' */
|
||||
DBUG_ASSERT(extended_row.str[extended_row.length] == '\0');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1239,3 +1239,18 @@ Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_next 6
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (c int PRIMARY KEY, e int NOT NULL);
|
||||
INSERT INTO t1 VALUES (1,0), (2,1);
|
||||
CREATE TABLE t2 (d int PRIMARY KEY);
|
||||
INSERT INTO t2 VALUES (1), (2), (3);
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||
1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using where; Using index; Not exists
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL;
|
||||
c e d
|
||||
1 0 NULL
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d<=>NULL;
|
||||
c e d
|
||||
1 0 NULL
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -41,3 +41,85 @@ select 1;
|
||||
select RELEASE_LOCK("a");
|
||||
RELEASE_LOCK("a")
|
||||
1
|
||||
create table t1(f1 int);
|
||||
create function bug27563() returns int(11)
|
||||
deterministic
|
||||
begin
|
||||
declare continue handler for sqlstate '70100' set @a:= 'killed';
|
||||
declare continue handler for sqlexception set @a:= 'exception';
|
||||
set @a= get_lock("lock27563", 10);
|
||||
return 1;
|
||||
end|
|
||||
select get_lock("lock27563",10);
|
||||
get_lock("lock27563",10)
|
||||
1
|
||||
insert into t1 values (bug27563());
|
||||
ERROR 70100: Query execution was interrupted
|
||||
select @a;
|
||||
@a
|
||||
NULL
|
||||
select * from t1;
|
||||
f1
|
||||
insert into t1 values(0);
|
||||
update t1 set f1= bug27563();
|
||||
ERROR 70100: Query execution was interrupted
|
||||
select @a;
|
||||
@a
|
||||
NULL
|
||||
select * from t1;
|
||||
f1
|
||||
0
|
||||
insert into t1 values(1);
|
||||
delete from t1 where bug27563() is null;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
select @a;
|
||||
@a
|
||||
NULL
|
||||
select * from t1;
|
||||
f1
|
||||
0
|
||||
1
|
||||
select * from t1 where f1= bug27563();
|
||||
ERROR 70100: Query execution was interrupted
|
||||
select @a;
|
||||
@a
|
||||
NULL
|
||||
create procedure proc27563()
|
||||
begin
|
||||
declare continue handler for sqlstate '70100' set @a:= 'killed';
|
||||
declare continue handler for sqlexception set @a:= 'exception';
|
||||
select get_lock("lock27563",10);
|
||||
select "shouldn't be selected";
|
||||
end|
|
||||
call proc27563();
|
||||
get_lock("lock27563",10)
|
||||
NULL
|
||||
ERROR 70100: Query execution was interrupted
|
||||
select @a;
|
||||
@a
|
||||
NULL
|
||||
create table t2 (f2 int);
|
||||
create trigger trg27563 before insert on t1 for each row
|
||||
begin
|
||||
declare continue handler for sqlstate '70100' set @a:= 'killed';
|
||||
declare continue handler for sqlexception set @a:= 'exception';
|
||||
set @a:= get_lock("lock27563",10);
|
||||
insert into t2 values(1);
|
||||
end|
|
||||
insert into t1 values(2),(3);
|
||||
ERROR 70100: Query execution was interrupted
|
||||
select @a;
|
||||
@a
|
||||
NULL
|
||||
select * from t1;
|
||||
f1
|
||||
0
|
||||
1
|
||||
select * from t2;
|
||||
f2
|
||||
select release_lock("lock27563");
|
||||
release_lock("lock27563")
|
||||
1
|
||||
drop table t1, t2;
|
||||
drop function bug27563;
|
||||
drop procedure proc27563;
|
||||
|
@ -3309,6 +3309,17 @@ drop user user1;
|
||||
drop user user2;
|
||||
drop database mysqldump_test_db;
|
||||
#
|
||||
# Bug #28522: buffer overrun by '\0' byte using --hex-blob.
|
||||
#
|
||||
CREATE TABLE t1 (c1 INT, c2 LONGBLOB);
|
||||
INSERT INTO t1 SET c1=11, c2=REPEAT('q',509);
|
||||
CREATE TABLE `t1` (
|
||||
`c1` int(11) default NULL,
|
||||
`c2` longblob
|
||||
);
|
||||
INSERT INTO `t1` VALUES (11,0x7171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171);
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 5.0 tests
|
||||
#
|
||||
drop table if exists t1;
|
||||
|
@ -3359,6 +3359,16 @@ SHOW CREATE VIEW v1;
|
||||
View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(1.23456789 as decimal(8,0)) AS `col`
|
||||
DROP VIEW v1;
|
||||
CREATE TABLE t1 (id int);
|
||||
CREATE TABLE t2 (id int, c int DEFAULT 0);
|
||||
INSERT INTO t1 (id) VALUES (1);
|
||||
INSERT INTO t2 (id) VALUES (1);
|
||||
CREATE VIEW v1 AS
|
||||
SELECT t2.c FROM t1, t2
|
||||
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
|
||||
UPDATE v1 SET c=1;
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.0 tests.
|
||||
DROP DATABASE IF EXISTS `d-1`;
|
||||
CREATE DATABASE `d-1`;
|
||||
|
@ -851,3 +851,19 @@ SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL;
|
||||
show status like 'Handler_read%';
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
#
|
||||
# Bug 28571: outer join with false on condition over constant tables
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c int PRIMARY KEY, e int NOT NULL);
|
||||
INSERT INTO t1 VALUES (1,0), (2,1);
|
||||
CREATE TABLE t2 (d int PRIMARY KEY);
|
||||
INSERT INTO t2 VALUES (1), (2), (3);
|
||||
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL;
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL;
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d<=>NULL;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
|
@ -117,3 +117,135 @@ reap;
|
||||
select 1;
|
||||
connection con1;
|
||||
select RELEASE_LOCK("a");
|
||||
|
||||
#
|
||||
# Bug#27563: Stored functions and triggers wasn't throwing an error when killed.
|
||||
#
|
||||
create table t1(f1 int);
|
||||
delimiter |;
|
||||
create function bug27563() returns int(11)
|
||||
deterministic
|
||||
begin
|
||||
declare continue handler for sqlstate '70100' set @a:= 'killed';
|
||||
declare continue handler for sqlexception set @a:= 'exception';
|
||||
set @a= get_lock("lock27563", 10);
|
||||
return 1;
|
||||
end|
|
||||
delimiter ;|
|
||||
# Test stored functions
|
||||
# Test INSERT
|
||||
connection con1;
|
||||
select get_lock("lock27563",10);
|
||||
connection con2;
|
||||
let $ID= `select connection_id()`;
|
||||
send insert into t1 values (bug27563());
|
||||
real_sleep 2;
|
||||
connection con1;
|
||||
disable_query_log;
|
||||
eval kill query $ID;
|
||||
enable_query_log;
|
||||
connection con2;
|
||||
--error 1317
|
||||
reap;
|
||||
select @a;
|
||||
connection con1;
|
||||
select * from t1;
|
||||
|
||||
# Test UPDATE
|
||||
insert into t1 values(0);
|
||||
connection con2;
|
||||
send update t1 set f1= bug27563();
|
||||
real_sleep 2;
|
||||
connection con1;
|
||||
disable_query_log;
|
||||
eval kill query $ID;
|
||||
enable_query_log;
|
||||
connection con2;
|
||||
--error 1317
|
||||
reap;
|
||||
select @a;
|
||||
connection con1;
|
||||
select * from t1;
|
||||
|
||||
# Test DELETE
|
||||
insert into t1 values(1);
|
||||
connection con2;
|
||||
send delete from t1 where bug27563() is null;
|
||||
real_sleep 2;
|
||||
connection con1;
|
||||
disable_query_log;
|
||||
eval kill query $ID;
|
||||
enable_query_log;
|
||||
connection con2;
|
||||
--error 1317
|
||||
reap;
|
||||
select @a;
|
||||
connection con1;
|
||||
select * from t1;
|
||||
|
||||
# Test SELECT
|
||||
connection con2;
|
||||
send select * from t1 where f1= bug27563();
|
||||
real_sleep 2;
|
||||
connection con1;
|
||||
disable_query_log;
|
||||
eval kill query $ID;
|
||||
enable_query_log;
|
||||
connection con2;
|
||||
--error 1317
|
||||
reap;
|
||||
select @a;
|
||||
|
||||
# Test PROCEDURE
|
||||
connection con2;
|
||||
delimiter |;
|
||||
create procedure proc27563()
|
||||
begin
|
||||
declare continue handler for sqlstate '70100' set @a:= 'killed';
|
||||
declare continue handler for sqlexception set @a:= 'exception';
|
||||
select get_lock("lock27563",10);
|
||||
select "shouldn't be selected";
|
||||
end|
|
||||
delimiter ;|
|
||||
send call proc27563();
|
||||
real_sleep 2;
|
||||
connection con1;
|
||||
disable_query_log;
|
||||
eval kill query $ID;
|
||||
enable_query_log;
|
||||
connection con2;
|
||||
--error 1317
|
||||
reap;
|
||||
select @a;
|
||||
|
||||
# Test TRIGGERS
|
||||
connection con2;
|
||||
create table t2 (f2 int);
|
||||
delimiter |;
|
||||
create trigger trg27563 before insert on t1 for each row
|
||||
begin
|
||||
declare continue handler for sqlstate '70100' set @a:= 'killed';
|
||||
declare continue handler for sqlexception set @a:= 'exception';
|
||||
set @a:= get_lock("lock27563",10);
|
||||
insert into t2 values(1);
|
||||
end|
|
||||
delimiter ;|
|
||||
send insert into t1 values(2),(3);
|
||||
real_sleep 2;
|
||||
connection con1;
|
||||
disable_query_log;
|
||||
eval kill query $ID;
|
||||
enable_query_log;
|
||||
connection con2;
|
||||
--error 1317
|
||||
reap;
|
||||
select @a;
|
||||
connection con1;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
|
||||
# Cleanup
|
||||
select release_lock("lock27563");
|
||||
drop table t1, t2;
|
||||
drop function bug27563;
|
||||
drop procedure proc27563;
|
||||
|
@ -1528,7 +1528,14 @@ drop user user2;
|
||||
|
||||
drop database mysqldump_test_db;
|
||||
|
||||
--echo #
|
||||
--echo # Bug #28522: buffer overrun by '\0' byte using --hex-blob.
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (c1 INT, c2 LONGBLOB);
|
||||
INSERT INTO t1 SET c1=11, c2=REPEAT('q',509);
|
||||
--exec $MYSQL_DUMP --skip-create --compact --hex-blob test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.0 tests
|
||||
|
@ -3055,6 +3055,25 @@ DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
#
|
||||
# Bug #28561: update on multi-table view with CHECK OPTION and
|
||||
# a subquery in WHERE condition
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (id int);
|
||||
CREATE TABLE t2 (id int, c int DEFAULT 0);
|
||||
INSERT INTO t1 (id) VALUES (1);
|
||||
INSERT INTO t2 (id) VALUES (1);
|
||||
|
||||
CREATE VIEW v1 AS
|
||||
SELECT t2.c FROM t1, t2
|
||||
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
|
||||
|
||||
UPDATE v1 SET c=1;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
# BUG#25897: Some queries are no longer possible after a CREATE VIEW
|
||||
# fails
|
||||
#
|
||||
|
@ -1175,7 +1175,7 @@ public:
|
||||
The maximum space available in a Field_varstring, in bytes. See
|
||||
length_bytes.
|
||||
*/
|
||||
static const int MAX_SIZE= UINT_MAX16;
|
||||
static const uint MAX_SIZE= UINT_MAX16;
|
||||
/* Store number of bytes used to store length (1 or 2) */
|
||||
uint32 length_bytes;
|
||||
Field_varstring(char *ptr_arg,
|
||||
|
@ -5318,6 +5318,8 @@ Item_func_sp::execute()
|
||||
{
|
||||
null_value= 1;
|
||||
context->process_error(thd);
|
||||
if (thd->killed)
|
||||
thd->send_kill_message();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1350,6 +1350,9 @@ err_with_cleanup:
|
||||
free_root(&call_mem_root, MYF(0));
|
||||
thd->spcont= octx;
|
||||
|
||||
if (thd->killed)
|
||||
thd->send_kill_message();
|
||||
|
||||
DBUG_RETURN(err_status);
|
||||
}
|
||||
|
||||
|
@ -6777,7 +6777,7 @@ fill_record(THD *thd, Field **ptr, List<Item> &values, bool ignore_errors)
|
||||
table= (*ptr)->table;
|
||||
table->auto_increment_field_not_null= FALSE;
|
||||
}
|
||||
while ((field = *ptr++))
|
||||
while ((field = *ptr++) && !thd->net.report_error)
|
||||
{
|
||||
value=v++;
|
||||
table= field->table;
|
||||
|
@ -6099,13 +6099,39 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
||||
}
|
||||
|
||||
/*
|
||||
Push down all predicates from on expressions.
|
||||
Each of these predicated are guarded by a variable
|
||||
Push down conditions from all on expressions.
|
||||
Each of these conditions are guarded by a variable
|
||||
that turns if off just before null complemented row for
|
||||
outer joins is formed. Thus, the predicates from an
|
||||
outer joins is formed. Thus, the condition from an
|
||||
'on expression' are guaranteed not to be checked for
|
||||
the null complemented row.
|
||||
*/
|
||||
|
||||
/* First push down constant conditions from on expressions */
|
||||
for (JOIN_TAB *join_tab= join->join_tab+join->const_tables;
|
||||
join_tab < join->join_tab+join->tables ; join_tab++)
|
||||
{
|
||||
if (*join_tab->on_expr_ref)
|
||||
{
|
||||
JOIN_TAB *cond_tab= join_tab->first_inner;
|
||||
COND *tmp= make_cond_for_table(*join_tab->on_expr_ref,
|
||||
join->const_table_map,
|
||||
(table_map) 0);
|
||||
if (!tmp)
|
||||
continue;
|
||||
tmp= new Item_func_trig_cond(tmp, &cond_tab->not_null_compl);
|
||||
if (!tmp)
|
||||
DBUG_RETURN(1);
|
||||
tmp->quick_fix_field();
|
||||
cond_tab->select_cond= !cond_tab->select_cond ? tmp :
|
||||
new Item_cond_and(cond_tab->select_cond,tmp);
|
||||
if (!cond_tab->select_cond)
|
||||
DBUG_RETURN(1);
|
||||
cond_tab->select_cond->quick_fix_field();
|
||||
}
|
||||
}
|
||||
|
||||
/* Push down non-constant conditions from on expressions */
|
||||
JOIN_TAB *last_tab= tab;
|
||||
while (first_inner_tab && first_inner_tab->last_inner == last_tab)
|
||||
{
|
||||
@ -6558,7 +6584,6 @@ void JOIN::cleanup(bool full)
|
||||
for (tab= join_tab, end= tab+tables; tab != end; tab++)
|
||||
tab->cleanup();
|
||||
table= 0;
|
||||
tables= 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user