mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
merge
This commit is contained in:
@ -86,3 +86,132 @@ ASC LIMIT 1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#27249 table_wild with alias: select t1.* as something
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (a int, b int, c int);
|
||||
create table t2 (d int);
|
||||
create table t3 (a1 int, b1 int, c1 int);
|
||||
insert into t1 values(1,2,3);
|
||||
insert into t1 values(11,22,33);
|
||||
insert into t2 values(99);
|
||||
|
||||
# Invalid queries with alias on wild
|
||||
--error ER_PARSE_ERROR
|
||||
select t1.* as 'with_alias' from t1;
|
||||
--error ER_PARSE_ERROR
|
||||
select t2.* as 'with_alias' from t2;
|
||||
--error ER_PARSE_ERROR
|
||||
select t1.*, t1.* as 'with_alias' from t1;
|
||||
--error ER_PARSE_ERROR
|
||||
select t1.* as 'with_alias', t1.* from t1;
|
||||
--error ER_PARSE_ERROR
|
||||
select t1.* as 'with_alias', t1.* as 'alias2' from t1;
|
||||
--error ER_PARSE_ERROR
|
||||
select t1.* as 'with_alias', a, t1.* as 'alias2' from t1;
|
||||
|
||||
# other fields without alias
|
||||
--error ER_PARSE_ERROR
|
||||
select a, t1.* as 'with_alias' from t1;
|
||||
--error ER_PARSE_ERROR
|
||||
select t1.* as 'with_alias', a from t1;
|
||||
--error ER_PARSE_ERROR
|
||||
select a, t1.* as 'with_alias', b from t1;
|
||||
--error ER_PARSE_ERROR
|
||||
select (select d from t2 where d > a), t1.* as 'with_alias' from t1;
|
||||
--error ER_PARSE_ERROR
|
||||
select t1.* as 'with_alias', (select a from t2 where d > a) from t1;
|
||||
|
||||
# other fields with alias
|
||||
--error ER_PARSE_ERROR
|
||||
select a as 'x', t1.* as 'with_alias' from t1;
|
||||
--error ER_PARSE_ERROR
|
||||
select t1.* as 'with_alias', a as 'x' from t1;
|
||||
--error ER_PARSE_ERROR
|
||||
select a as 'x', t1.* as 'with_alias', b as 'x' from t1;
|
||||
--error ER_PARSE_ERROR
|
||||
select (select d from t2 where d > a) as 'x', t1.* as 'with_alias' from t1;
|
||||
--error ER_PARSE_ERROR
|
||||
select t1.* as 'with_alias', (select a from t2 where d > a) as 'x' from t1;
|
||||
|
||||
# some more subquery
|
||||
--error ER_PARSE_ERROR
|
||||
select (select t2.* as 'x' from t2) from t1;
|
||||
--error ER_PARSE_ERROR
|
||||
select a, (select t2.* as 'x' from t2) from t1;
|
||||
--error ER_PARSE_ERROR
|
||||
select t1.*, (select t2.* as 'x' from t2) from t1;
|
||||
|
||||
# insert
|
||||
--error ER_PARSE_ERROR
|
||||
insert into t3 select t1.* as 'with_alias' from t1;
|
||||
--error ER_PARSE_ERROR
|
||||
insert into t3 select t2.* as 'with_alias', 1, 2 from t2;
|
||||
--error ER_PARSE_ERROR
|
||||
insert into t3 select t2.* as 'with_alias', d as 'x', d as 'z' from t2;
|
||||
--error ER_PARSE_ERROR
|
||||
insert into t3 select t2.*, t2.* as 'with_alias', 3 from t2;
|
||||
|
||||
# create
|
||||
--error ER_PARSE_ERROR
|
||||
create table t3 select t1.* as 'with_alias' from t1;
|
||||
--error ER_PARSE_ERROR
|
||||
create table t3 select t2.* as 'with_alias', 1, 2 from t2;
|
||||
--error ER_PARSE_ERROR
|
||||
create table t3 select t2.* as 'with_alias', d as 'x', d as 'z' from t2;
|
||||
--error ER_PARSE_ERROR
|
||||
create table t3 select t2.*, t2.* as 'with_alias', 3 from t2;
|
||||
|
||||
#
|
||||
# Valid queries without alias on wild
|
||||
# (proof the above fail due to invalid aliasing)
|
||||
#
|
||||
|
||||
select t1.* from t1;
|
||||
select t2.* from t2;
|
||||
select t1.*, t1.* from t1;
|
||||
select t1.*, a, t1.* from t1;
|
||||
|
||||
# other fields without alias
|
||||
select a, t1.* from t1;
|
||||
select t1.*, a from t1;
|
||||
select a, t1.*, b from t1;
|
||||
select (select d from t2 where d > a), t1.* from t1;
|
||||
select t1.*, (select a from t2 where d > a) from t1;
|
||||
|
||||
# other fields with alias
|
||||
select a as 'x', t1.* from t1;
|
||||
select t1.*, a as 'x' from t1;
|
||||
select a as 'x', t1.*, b as 'x' from t1;
|
||||
select (select d from t2 where d > a) as 'x', t1.* from t1;
|
||||
select t1.*, (select a from t2 where d > a) as 'x' from t1;
|
||||
|
||||
# some more subquery
|
||||
select (select t2.* from t2) from t1;
|
||||
select a, (select t2.* from t2) from t1;
|
||||
select t1.*, (select t2.* from t2) from t1;
|
||||
|
||||
# insert
|
||||
insert into t3 select t1.* from t1;
|
||||
insert into t3 select t2.*, 1, 2 from t2;
|
||||
insert into t3 select t2.*, d as 'x', d as 'z' from t2;
|
||||
insert into t3 select t2.*, t2.*, 3 from t2;
|
||||
|
||||
# create
|
||||
create table t4 select t1.* from t1;
|
||||
drop table t4;
|
||||
create table t4 select t2.*, 1, 2 from t2;
|
||||
drop table t4;
|
||||
create table t4 select t2.*, d as 'x', d as 'z' from t2;
|
||||
drop table t4;
|
||||
|
||||
# end
|
||||
drop table t1,t2,t3;
|
||||
|
||||
# End of 5.2 tests
|
||||
|
@ -265,8 +265,8 @@ DELETE FROM t1, alias USING t1, t2 alias WHERE t1.a = alias.a;
|
||||
DELETE FROM t1, t2 USING t1, t2 alias WHERE t1.a = alias.a;
|
||||
--error ER_PARSE_ERROR
|
||||
DELETE FROM db1.t1 alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
DELETE FROM alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
DELETE FROM db2.alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
|
||||
DELETE FROM t1 USING t1 WHERE a = 1;
|
||||
SELECT * FROM t1;
|
||||
@ -293,6 +293,159 @@ DROP FUNCTION f1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
#
|
||||
# Bug#27525: table not found when using multi-table-deletes with aliases over
|
||||
# several databas
|
||||
# Bug#21148: MULTI-DELETE fails to resolve a table by alias if it's from a
|
||||
# different database
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS db1;
|
||||
DROP DATABASE IF EXISTS db2;
|
||||
DROP DATABASE IF EXISTS db3;
|
||||
DROP DATABASE IF EXISTS db4;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP PROCEDURE IF EXISTS count;
|
||||
--enable_warnings
|
||||
USE test;
|
||||
CREATE DATABASE db1;
|
||||
CREATE DATABASE db2;
|
||||
|
||||
CREATE TABLE db1.t1 (a INT, b INT);
|
||||
INSERT INTO db1.t1 VALUES (1,1),(2,2),(3,3);
|
||||
CREATE TABLE db1.t2 AS SELECT * FROM db1.t1;
|
||||
CREATE TABLE db2.t1 AS SELECT * FROM db1.t2;
|
||||
CREATE TABLE db2.t2 AS SELECT * FROM db2.t1;
|
||||
CREATE TABLE t1 AS SELECT * FROM db2.t2;
|
||||
CREATE TABLE t2 AS SELECT * FROM t1;
|
||||
|
||||
delimiter |;
|
||||
CREATE PROCEDURE count_rows()
|
||||
BEGIN
|
||||
SELECT COUNT(*) AS "COUNT(db1.t1)" FROM db1.t1;
|
||||
SELECT COUNT(*) AS "COUNT(db1.t2)" FROM db1.t2;
|
||||
SELECT COUNT(*) AS "COUNT(db2.t1)" FROM db2.t1;
|
||||
SELECT COUNT(*) AS "COUNT(db2.t2)" FROM db2.t2;
|
||||
SELECT COUNT(*) AS "COUNT(test.t1)" FROM test.t1;
|
||||
SELECT COUNT(*) AS "COUNT(test.t2)" FROM test.t2;
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
#
|
||||
# Testing without a selected database
|
||||
#
|
||||
|
||||
CREATE DATABASE db3;
|
||||
USE db3;
|
||||
DROP DATABASE db3;
|
||||
--error ER_NO_DB_ERROR
|
||||
SELECT * FROM t1;
|
||||
|
||||
# Detect missing table references
|
||||
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE a1,a2 FROM db1.t1, db2.t2;
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE a1,a2 FROM db1.t1, db2.t2;
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE a1,a2 FROM db1.t1 AS a1, db2.t2;
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE a1,a2 FROM db1.t1, db2.t2 AS a2;
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
|
||||
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE FROM a1,a2 USING db1.t1, db2.t2;
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE FROM a1,a2 USING db1.t1, db2.t2;
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE FROM a1,a2 USING db1.t1 AS a1, db2.t2;
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE FROM a1,a2 USING db1.t1, db2.t2 AS a2;
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
|
||||
|
||||
# Ambiguous table references
|
||||
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE a1 FROM db1.t1 AS a1, db2.t2 AS a1;
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE a1 FROM db1.a1, db2.t2 AS a1;
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE a1 FROM a1, db1.t1 AS a1;
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE t1 FROM db1.t1, db2.t1 AS a1;
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE t1 FROM db1.t1 AS a1, db2.t1 AS a2;
|
||||
--error ER_NO_DB_ERROR
|
||||
DELETE t1 FROM db1.t1, db2.t1;
|
||||
|
||||
# Test all again, now with a selected database
|
||||
|
||||
USE test;
|
||||
|
||||
# Detect missing table references
|
||||
|
||||
--error ER_UNKNOWN_TABLE
|
||||
DELETE a1,a2 FROM db1.t1, db2.t2;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
DELETE a1,a2 FROM db1.t1, db2.t2;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
DELETE a1,a2 FROM db1.t1 AS a1, db2.t2;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
DELETE a1,a2 FROM db1.t1, db2.t2 AS a2;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
|
||||
|
||||
--error ER_UNKNOWN_TABLE
|
||||
DELETE FROM a1,a2 USING db1.t1, db2.t2;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
DELETE FROM a1,a2 USING db1.t1, db2.t2;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
DELETE FROM a1,a2 USING db1.t1 AS a1, db2.t2;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
DELETE FROM a1,a2 USING db1.t1, db2.t2 AS a2;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
|
||||
|
||||
# Ambiguous table references
|
||||
|
||||
--error ER_NONUNIQ_TABLE
|
||||
DELETE a1 FROM db1.t1 AS a1, db2.t2 AS a1;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
DELETE a1 FROM db1.a1, db2.t2 AS a1;
|
||||
--error ER_NONUNIQ_TABLE
|
||||
DELETE a1 FROM a1, db1.t1 AS a1;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
DELETE t1 FROM db1.t1, db2.t1 AS a1;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
DELETE t1 FROM db1.t1 AS a1, db2.t1 AS a2;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
DELETE t1 FROM db1.t1, db2.t1;
|
||||
|
||||
# Test multiple-table cross database deletes
|
||||
|
||||
DELETE t1 FROM db1.t2 AS t1, db2.t2 AS t2 WHERE t2.a = 1 AND t1.a = t2.a;
|
||||
SELECT ROW_COUNT();
|
||||
CALL count_rows();
|
||||
DELETE a1, a2 FROM db2.t1 AS a1, t2 AS a2 WHERE a1.a = 2 AND a2.a = 2;
|
||||
SELECT ROW_COUNT();
|
||||
CALL count_rows();
|
||||
|
||||
DROP DATABASE db1;
|
||||
DROP DATABASE db2;
|
||||
DROP PROCEDURE count_rows;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#46958: Assertion in Diagnostics_area::set_ok_status, trigger,
|
||||
--echo # merge table
|
||||
|
@ -158,7 +158,7 @@ UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) >
|
||||
delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
||||
select * from t1;
|
||||
--replace_result P2 p2
|
||||
--error ER_UNKNOWN_TABLE
|
||||
--error ER_NON_UPDATABLE_TABLE
|
||||
delete P1.*,P2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
||||
-- error 1054
|
||||
delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
||||
|
@ -1,3 +1,4 @@
|
||||
--source include/not_embedded.inc
|
||||
|
||||
# Save the initial number of concurrent sessions
|
||||
--source include/count_sessions.inc
|
||||
@ -22,6 +23,38 @@ disconnect con2;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#10374 GET_LOCK does not let connection to close on the server side if it's aborted
|
||||
#
|
||||
|
||||
connection default;
|
||||
SELECT GET_LOCK("dangling", 0);
|
||||
connect(con1, localhost, root,,);
|
||||
connection con1;
|
||||
--send SELECT GET_LOCK('dangling', 3600);
|
||||
connection default;
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = "User lock"
|
||||
AND INFO = "SELECT GET_LOCK('dangling', 3600)";
|
||||
--source include/wait_condition.inc
|
||||
dirty_close con1;
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = "User lock"
|
||||
AND INFO = "SELECT GET_LOCK('dangling', 3600)";
|
||||
--source include/wait_condition.inc
|
||||
connect(con1, localhost, root,,);
|
||||
--send SELECT GET_LOCK('dangling', 3600);
|
||||
connection default;
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = "User lock"
|
||||
AND INFO = "SELECT GET_LOCK('dangling', 3600)";
|
||||
--source include/wait_condition.inc
|
||||
SELECT RELEASE_LOCK('dangling');
|
||||
connection con1;
|
||||
--reap
|
||||
connection default;
|
||||
disconnect con1;
|
||||
|
||||
# Wait till all disconnects are completed
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
||||
|
@ -309,4 +309,15 @@ DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
|
||||
#
|
||||
# Bug #8457: Precision math:
|
||||
# DIV returns incorrect result with large decimal value
|
||||
# Bug #46606:Casting error for large numbers in 5.4 when 'div' is used
|
||||
|
||||
--error ER_WARN_DATA_OUT_OF_RANGE
|
||||
select 123456789012345678901234567890.123456789012345678901234567890 div 1 as x;
|
||||
--error ER_WARN_DATA_OUT_OF_RANGE
|
||||
select "123456789012345678901234567890.123456789012345678901234567890" div 1 as x;
|
||||
SHOW WARNINGS;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -169,4 +169,26 @@ SELECT TIMEDIFF(TIME('17:00:00'),TIME('17:00:00'))=TIME('00:00:00') AS 1Eq,
|
||||
TIMEDIFF(TIME('17:59:00'),TIME('17:00:00')),
|
||||
TIMEDIFF(TIME('17:00:00'),TIME('17:59:00'));
|
||||
|
||||
#
|
||||
# Bug#42661 - sec_to_time() and signedness
|
||||
#
|
||||
|
||||
SELECT sec_to_time(3020399)=TIME('838:59:59');
|
||||
SELECT sec_to_time(-3020399)=TIME('-838:59:59');
|
||||
SELECT sec_to_time(-3020399)='-838:59:59';
|
||||
SELECT time(sec_to_time(-3020399))=TIME('-838:59:59');
|
||||
SELECT time(sec_to_time(-3020399))=TIME('-838:59:58');
|
||||
|
||||
#
|
||||
# Bug#42662 - maketime() and signedness
|
||||
#
|
||||
|
||||
# TIME(...) and CAST(... AS TIME) go through the same code-path here,
|
||||
# but we'll explicitly show show that both work in case the ever changes.
|
||||
SELECT maketime(-1,0,1)='-01:00:01';
|
||||
SELECT TIME(maketime(-1,0,1))=CAST('-01:00:01' AS TIME);
|
||||
SELECT maketime(-1,0,1)=CAST('-01:00:01' AS TIME);
|
||||
SELECT maketime(1,0,1)=CAST('01:00:01' AS TIME);
|
||||
SELECT maketime(1,0,1)=CAST('01:00:02' AS TIME);
|
||||
|
||||
# End of 5.0 tests
|
||||
|
@ -819,6 +819,16 @@ SELECT '2008-02-18' + INTERVAL 1 FRAC_SECOND;
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT '2008-02-18' - INTERVAL 1 FRAC_SECOND;
|
||||
|
||||
#
|
||||
# Bug #36466:
|
||||
# Adding days to day_microsecond changes interpretation of microseconds
|
||||
#
|
||||
|
||||
# show that we treat fractions of seconds correctly (zerofill from right to
|
||||
# six places) even if we left out fields on the left.
|
||||
select date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond);
|
||||
select date_add('1000-01-01 00:00:00', interval '1.02' day_microsecond);
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
#
|
||||
|
@ -1,5 +1,3 @@
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
# Save the initial number of concurrent sessions
|
||||
--source include/count_sessions.inc
|
||||
|
||||
|
@ -366,6 +366,14 @@ remove_file $MYSQLTEST_VARDIR/tmp/bug31060.sql;
|
||||
--exec $MYSQL --server-arg=no-defaults test -e "quit"
|
||||
--enable_query_log
|
||||
|
||||
#
|
||||
# Bug#26780: patch to add auto vertical output option to the cli.
|
||||
#
|
||||
# Make this wide enough that it will wrap almost everywhere.
|
||||
--exec $MYSQL test --auto-vertical-output --table -e "SELECT 1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0;"
|
||||
# Too short to wrap.
|
||||
--exec $MYSQL test --auto-vertical-output --table -e "SELECT 1;"
|
||||
|
||||
#
|
||||
# Bug #25146: Some warnings/errors not shown when using --show-warnings
|
||||
#
|
||||
|
41
mysql-test/t/partition_sync.test
Normal file
41
mysql-test/t/partition_sync.test
Normal file
@ -0,0 +1,41 @@
|
||||
--source include/have_partition.inc
|
||||
# Save the initial number of concurrent sessions.
|
||||
--source include/count_sessions.inc
|
||||
|
||||
--echo #
|
||||
--echo # Bug #43867 ALTER TABLE on a partitioned table
|
||||
--echo # causes unnecessary deadlocks
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a int) PARTITION BY RANGE (a)
|
||||
(PARTITION p0 VALUES LESS THAN (1),
|
||||
PARTITION p1 VALUES LESS THAN (2));
|
||||
|
||||
INSERT INTO t1 VALUES (0),(1);
|
||||
|
||||
connect(con1,localhost,root);
|
||||
|
||||
--echo # Connection 2
|
||||
connection con1;
|
||||
BEGIN;
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo # Connection 1
|
||||
connection default;
|
||||
--error ER_DROP_PARTITION_NON_EXISTENT
|
||||
ALTER TABLE t1 DROP PARTITION p3;
|
||||
|
||||
--echo # Connection 2
|
||||
connection con1;
|
||||
--echo # This failed with deadlock and should not do so.
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo # Connection 1
|
||||
connection default;
|
||||
disconnect con1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
# Check that all connections opened by test cases in this file are really
|
||||
# gone so execution of other tests won't be affected by their presence.
|
||||
--source include/wait_until_count_sessions.inc
|
25
mysql-test/t/rpl_mysqldump_slave.test
Normal file
25
mysql-test/t/rpl_mysqldump_slave.test
Normal file
@ -0,0 +1,25 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
--echo #
|
||||
--echo # New --dump-slave, --apply-slave-statements functionality
|
||||
--echo #
|
||||
|
||||
# There is a gap between when START SLAVE returns and when MASTER_LOG_FILE and
|
||||
# MASTER_LOG_POS are set. Ensure that we don't call SHOW SLAVE STATUS during
|
||||
# that gap.
|
||||
--sync_slave_with_master
|
||||
|
||||
connection master;
|
||||
use test;
|
||||
|
||||
connection slave;
|
||||
|
||||
# Execute mysqldump with --dump-slave
|
||||
--exec $MYSQL_DUMP_SLAVE --compact --dump-slave test
|
||||
|
||||
# Execute mysqldump with --dump-slave and --apply-slave-statements
|
||||
--exec $MYSQL_DUMP_SLAVE --compact --dump-slave --apply-slave-statements test
|
||||
|
||||
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||
# Execute mysqldump with --dump-slave ,--apply-slave-statements and --include-master-host-port
|
||||
--exec $MYSQL_DUMP_SLAVE --compact --dump-slave --apply-slave-statements --include-master-host-port test
|
@ -7,10 +7,17 @@ let $shm= query_get_value("SHOW VARIABLES LIKE 'shared_memory'", Value, 1);
|
||||
if (`SELECT '$shm' != 'ON'`){
|
||||
skip No shm support;
|
||||
}
|
||||
let $shm_name= query_get_value("SHOW GLOBAL VARIABLES LIKE 'shared_memory_base_name'", Value, 1);
|
||||
|
||||
# Connect using SHM for testing
|
||||
connect(shm_con,localhost,root,,,,$shm_name,SHM);
|
||||
|
||||
# Source select test case
|
||||
-- source include/common-tests.inc
|
||||
|
||||
connection default;
|
||||
disconnect shm_con;
|
||||
|
||||
#
|
||||
# Bug #24924: shared-memory-base-name that is too long causes buffer overflow
|
||||
#
|
||||
@ -20,7 +27,6 @@ if (`SELECT '$shm' != 'ON'`){
|
||||
# Bug #33899: Deadlock in mysql_real_query with shared memory connections
|
||||
#
|
||||
|
||||
let $name= query_get_value("SHOW GLOBAL VARIABLES LIKE 'shared_memory_base_name'", Value, 1);
|
||||
let $stmt= `SELECT REPEAT('a', 2048)`;
|
||||
|
||||
SET @max_allowed_packet= @@global.max_allowed_packet;
|
||||
@ -30,7 +36,7 @@ SET GLOBAL max_allowed_packet= 1024;
|
||||
SET GLOBAL net_buffer_length= 1024;
|
||||
|
||||
--error 1
|
||||
--exec echo SELECT '$stmt'| $MYSQL --protocol=memory --shared-memory-base-name=$name 2>&1
|
||||
--exec echo SELECT '$stmt'| $MYSQL --protocol=memory --shared-memory-base-name=$shm_name 2>&1
|
||||
|
||||
SET GLOBAL max_allowed_packet= @max_allowed_packet;
|
||||
SET GLOBAL net_buffer_length= @net_buffer_length;
|
||||
|
@ -2419,6 +2419,27 @@ end$$
|
||||
|
||||
delimiter ;$$
|
||||
|
||||
#
|
||||
# Bug#15192: "fatal errors" are caught by handlers in stored procedures
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists p1;
|
||||
--enable_warnings
|
||||
set @old_recursion_depth = @@max_sp_recursion_depth;
|
||||
set @@max_sp_recursion_depth = 255;
|
||||
delimiter |;
|
||||
create procedure p1(a int)
|
||||
begin
|
||||
declare continue handler for 1436 -- ER_STACK_OVERRUN_NEED_MORE
|
||||
select 'exception';
|
||||
call p1(a+1);
|
||||
end|
|
||||
delimiter ;|
|
||||
--error 0,ER_STACK_OVERRUN_NEED_MORE,ER_SP_RECURSION_LIMIT
|
||||
call p1(1);
|
||||
set @@max_sp_recursion_depth = @old_recursion_depth;
|
||||
drop procedure p1;
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
|
@ -8295,6 +8295,119 @@ SELECT * FROM t1 WHERE a = f1();
|
||||
DROP FUNCTION f1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#36649: Condition area is not properly cleaned up after stored routine invocation
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
--enable_warnings
|
||||
|
||||
delimiter |;
|
||||
CREATE PROCEDURE p1(a INT, b CHAR)
|
||||
BEGIN
|
||||
IF a > 0 THEN
|
||||
CALL p1(a-1, 'ab');
|
||||
ELSE
|
||||
SELECT 1;
|
||||
END IF;
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
SET @save_max_sp_recursion= @@max_sp_recursion_depth;
|
||||
SET @@max_sp_recursion_depth= 5;
|
||||
CALL p1(4, 'a');
|
||||
SET @@max_sp_recursion_depth= @save_max_sp_recursion;
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
#
|
||||
# Ensure that rules for message list clean up are being respected.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
--enable_warnings
|
||||
|
||||
delimiter |;
|
||||
CREATE PROCEDURE p1(a CHAR)
|
||||
BEGIN
|
||||
SELECT 1;
|
||||
SELECT CAST('10 ' as UNSIGNED INTEGER);
|
||||
SELECT 1;
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
CALL p1('data truncated parameter');
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
#
|
||||
# Cascading stored procedure/function calls.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
DROP PROCEDURE IF EXISTS p3;
|
||||
DROP PROCEDURE IF EXISTS p4;
|
||||
--enable_warnings
|
||||
|
||||
delimiter |;
|
||||
CREATE PROCEDURE p1()
|
||||
CALL p2()|
|
||||
CREATE PROCEDURE p2()
|
||||
CALL p3()|
|
||||
CREATE PROCEDURE p3()
|
||||
CALL p4()|
|
||||
CREATE PROCEDURE p4()
|
||||
BEGIN
|
||||
SELECT 1;
|
||||
SELECT CAST('10 ' as UNSIGNED INTEGER);
|
||||
SELECT 2;
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
CALL p1();
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
DROP PROCEDURE p3;
|
||||
DROP PROCEDURE p4;
|
||||
|
||||
--disable_warnings
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
DROP FUNCTION IF EXISTS f2;
|
||||
DROP FUNCTION IF EXISTS f3;
|
||||
DROP FUNCTION IF EXISTS f4;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a CHAR(2));
|
||||
|
||||
INSERT INTO t1 VALUES ('aa');
|
||||
|
||||
delimiter |;
|
||||
CREATE FUNCTION f1() RETURNS CHAR
|
||||
RETURN (SELECT f2())|
|
||||
CREATE FUNCTION f2() RETURNS CHAR
|
||||
RETURN (SELECT f3())|
|
||||
CREATE FUNCTION f3() RETURNS CHAR
|
||||
RETURN (SELECT f4())|
|
||||
CREATE FUNCTION f4() RETURNS CHAR
|
||||
BEGIN
|
||||
RETURN (SELECT a FROM t1);
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
SELECT f1();
|
||||
|
||||
DROP FUNCTION f1;
|
||||
DROP FUNCTION f2;
|
||||
DROP FUNCTION f3;
|
||||
DROP FUNCTION f4;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#34197: CREATE PROCEDURE fails when COMMENT truncated in non
|
||||
--echo # strict SQL mode
|
||||
|
@ -2425,3 +2425,67 @@ DELETE FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TEMPORARY TABLE t2;
|
||||
|
||||
#
|
||||
# Bug#36649: Condition area is not properly cleaned up after stored routine invocation
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TRIGGER IF EXISTS trg1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
|
||||
delimiter |;
|
||||
CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE a CHAR;
|
||||
SELECT 'ab' INTO a;
|
||||
SELECT 'ab' INTO a;
|
||||
SELECT 'a' INTO a;
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
INSERT INTO t1 VALUES (1);
|
||||
|
||||
DROP TRIGGER trg1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Successive trigger actuations
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TRIGGER IF EXISTS trg1;
|
||||
DROP TRIGGER IF EXISTS trg2;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
|
||||
delimiter |;
|
||||
|
||||
CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE trg1 CHAR;
|
||||
SELECT 'ab' INTO trg1;
|
||||
END|
|
||||
|
||||
CREATE TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE trg2 CHAR;
|
||||
SELECT 'ab' INTO trg2;
|
||||
END|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
INSERT INTO t1 VALUES (0);
|
||||
SELECT * FROM t1;
|
||||
SHOW WARNINGS;
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
|
||||
DROP TRIGGER trg1;
|
||||
DROP TRIGGER trg2;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
@ -612,3 +612,23 @@ explain select convert(1, binary(4294967296));
|
||||
explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
#
|
||||
# Bug #33969: Updating a text field via a left join
|
||||
#
|
||||
|
||||
CREATE TABLE t1(id INT NOT NULL);
|
||||
CREATE TABLE t2(id INT NOT NULL, c TEXT NOT NULL);
|
||||
|
||||
INSERT INTO t1 VALUES (1);
|
||||
INSERT INTO t2 VALUES (1, '');
|
||||
|
||||
UPDATE t2 SET c = REPEAT('1', 70000);
|
||||
SELECT LENGTH(c) FROM t2;
|
||||
|
||||
UPDATE t1 LEFT JOIN t2 USING(id) SET t2.c = REPEAT('1', 70000) WHERE t1.id = 1;
|
||||
SELECT LENGTH(c) FROM t2;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -39,7 +39,7 @@ drop table t1;
|
||||
# SELECT CAST(0.2359591234567e+30 AS TIME);
|
||||
# ##########################################################
|
||||
|
||||
# End of 4.1 tests
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#29555: Comparing time values as strings may lead to a wrong result.
|
||||
@ -90,3 +90,22 @@ DROP TABLE t1;
|
||||
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
|
||||
#
|
||||
# Bug#42664 - Sign ignored for TIME types when not comparing as longlong
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (f1 TIME);
|
||||
INSERT INTO t1 VALUES ('24:00:00');
|
||||
SELECT '24:00:00' = (SELECT f1 FROM t1);
|
||||
SELECT CAST('24:00:00' AS TIME) = (SELECT f1 FROM t1);
|
||||
SELECT CAST('-24:00:00' AS TIME) = (SELECT f1 FROM t1);
|
||||
TRUNCATE t1;
|
||||
INSERT INTO t1 VALUES ('-24:00:00');
|
||||
SELECT CAST('24:00:00' AS TIME) = (SELECT f1 FROM t1);
|
||||
SELECT CAST('-24:00:00' AS TIME) = (SELECT f1 FROM t1);
|
||||
SELECT '-24:00:00' = (SELECT f1 FROM t1);
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 6.0 tests
|
||||
|
Reference in New Issue
Block a user