1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Merge from next-mr

This commit is contained in:
Bjorn Munch
2009-12-16 12:14:14 +01:00
1462 changed files with 149388 additions and 171426 deletions

View File

@@ -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

View File

@@ -1046,4 +1046,34 @@ ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx','a5','a6','a7','a8','a9',
--disable_info
DROP TABLE t1;
#
# Bug#43508: Renaming timestamp or date column triggers table copy
#
CREATE TABLE t1 (f1 TIMESTAMP NULL DEFAULT NULL,
f2 INT(11) DEFAULT NULL) ENGINE=MYISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES (NULL, NULL), ("2009-10-09 11:46:19", 2);
--echo this should affect no rows as there is no real change
--enable_info
ALTER TABLE t1 CHANGE COLUMN f1 f1_no_real_change TIMESTAMP NULL DEFAULT NULL;
--disable_info
DROP TABLE t1;
--echo End of 5.1 tests
#
# Bug #31031 ALTER TABLE regression in 5.0
#
# The ALTER TABLE operation failed with
# ERROR 1089 (HY000): Incorrect sub part key; ...
#
CREATE TABLE t1(c CHAR(10),
i INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY);
INSERT INTO t1 VALUES('a',2),('b',4),('c',6);
ALTER TABLE t1
DROP i,
ADD i INT UNSIGNED NOT NULL AUTO_INCREMENT,
AUTO_INCREMENT = 1;
DROP TABLE t1;

View File

@@ -10,36 +10,13 @@ insert into t1 values (1,2,"","Y","2002-03-03"), (3,4,"","N","2002-03-04"), (5,6
select count(*) from t1 procedure analyse();
select * from t1 procedure analyse();
select * from t1 procedure analyse(2);
--error ER_WRONG_USAGE
create table t2 select * from t1 procedure analyse();
select * from t2;
drop table t1,t2;
drop table t1;
--error ER_WRONG_USAGE
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
#
# Test with impossible where
#
create table t1 (a int not null);
create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2;
select * from t1 where 0=1 procedure analyse();
insert into t1 values(1);
drop table t2;
create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2;
select * from t2;
insert into t2 select * from t1 procedure analyse();
select * from t2;
insert into t1 values(2);
drop table t2;
create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2;
select * from t2;
insert into t2 select * from t1 procedure analyse();
select * from t2;
drop table t1,t2;
#
# Bug#2813 - analyse does not quote string values in enums from string
#
@@ -113,3 +90,46 @@ SELECT * FROM (SELECT * FROM t1) d PROCEDURE ANALYSE();
DROP TABLE t1;
--echo End of 4.1 tests
--echo #
--echo # Bug #48293: crash with procedure analyse, view with > 10 columns,
--echo # having clause...
--echo #
CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT,
f INT, g INT, h INT, i INT, j INT,k INT);
INSERT INTO t1 VALUES (),();
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
--echo #should have a derived table
EXPLAIN SELECT * FROM v1;
--echo #should not crash
--error ER_WRONG_USAGE
SELECT * FROM v1 PROCEDURE analyse();
--echo #should not crash
--error ER_WRONG_USAGE
SELECT * FROM t1 a, v1, t1 b PROCEDURE analyse();
--echo #should not crash
--error ER_WRONG_USAGE
SELECT * FROM (SELECT * FROM t1 having a > 1) x PROCEDURE analyse();
--echo #should not crash
--error ER_WRONG_USAGE
SELECT * FROM t1 a, (SELECT * FROM t1 having a > 1) x, t1 b PROCEDURE analyse();
--echo #should not crash
--error ER_ORDER_WITH_PROC
SELECT 1 FROM t1 group by a having a > 1 order by 1 PROCEDURE analyse();
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1),(2);
--echo # should not crash
--error ER_WRONG_USAGE
CREATE TABLE t2 SELECT 1 FROM t1, t1 t3 GROUP BY t3.a PROCEDURE ANALYSE();
DROP TABLE t1;
--echo End of 5.0 tests

View File

@@ -1623,3 +1623,36 @@ INSERT INTO t1 VALUES('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),
SELECT COUNT(t1.a) FROM t1, t1 a, t1 b, t1 c, t1 d, t1 e;
DROP TABLE t1;
SET @@join_buffer_size= @save_join_buffer_size;
--echo End of 5.1 tests
#
# BUG#40677 - Archive tables joined on primary return no result
#
CREATE TABLE t1(id INT NOT NULL AUTO_INCREMENT, name VARCHAR(128) NOT NULL, PRIMARY KEY(id)) ENGINE=archive;
INSERT INTO t1 VALUES(NULL,'a'),(NULL,'a');
CREATE TABLE t2(id INT NOT NULL AUTO_INCREMENT, name VARCHAR(128) NOT NULL, PRIMARY KEY(id)) ENGINE=archive;
INSERT INTO t2 VALUES(NULL,'b'),(NULL,'b');
SELECT t1.id, t2.id, t1.name, t2.name FROM t1,t2 WHERE t1.id = t2.id;
DROP TABLE t1,t2;
#
# BUG#47012 archive tables are not upgradeable, and server crashes on any access
#
let $MYSQLD_DATADIR= `SELECT @@datadir`;
copy_file std_data/bug47012.frm $MYSQLD_DATADIR/test/t1.frm;
copy_file std_data/bug47012.ARZ $MYSQLD_DATADIR/test/t1.ARZ;
copy_file std_data/bug47012.ARM $MYSQLD_DATADIR/test/t1.ARM;
--error ER_TABLE_NEEDS_UPGRADE
SHOW CREATE TABLE t1;
--error ER_TABLE_NEEDS_UPGRADE
SELECT * FROM t1;
--error ER_TABLE_NEEDS_UPGRADE
INSERT INTO t1 (col1, col2) VALUES (1, "value");
REPAIR TABLE t1;
DROP TABLE t1;
remove_file $MYSQLD_DATADIR/test/t1.ARM;

View File

@@ -1,5 +0,0 @@
#!/bin/sh
if [ "$MYSQL_TEST_DIR" ]
then
rm -f $MYSQLTEST_VARDIR/tmp/*.frm $MYSQLTEST_VARDIR/tmp/*.MY?
fi

View File

@@ -1,104 +0,0 @@
# The server need to be started in $MYSQLTEST_VARDIR since it
# uses ../../std_data/
--source include/uses_vardir.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
#
# This test is a bit tricky as we can't use backup table to overwrite an old
# table
#
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
set SQL_LOG_BIN=0;
--disable_warnings
drop table if exists t1, t2, t3, t4;
--enable_warnings
create table t4(n int);
--replace_result ": 1" ": X" ": 2" ": X" ": 22" ": X" ": 23" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
backup table t4 to '../../bogus';
backup table t4 to '../../tmp';
--replace_result ": 7" ": X" ": 17" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
backup table t4 to '../../tmp';
drop table t4;
restore table t4 from '../../tmp';
select count(*) from t4;
create table t1(n int);
insert into t1 values (23),(45),(67);
backup table t1 to '../../tmp';
drop table t1;
--replace_result ": 1" ": X" ": 2" ": X" ": 22" ": X" ": 23" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
restore table t1 from '../../bogus';
restore table t1 from '../../tmp';
select n from t1;
create table t2(m int not null primary key);
create table t3(k int not null primary key);
insert into t2 values (123),(145),(167);
insert into t3 values (223),(245),(267);
backup table t2,t3 to '../../tmp';
drop table t1,t2,t3;
restore table t1,t2,t3 from '../../tmp';
select n from t1;
select m from t2;
select k from t3;
drop table t1,t2,t3,t4;
restore table t1 from '../../tmp';
connection con2;
rename table t1 to t5;
--send
lock tables t5 write;
connection con1;
--send
backup table t5 to '../../tmp';
connection con2;
reap;
unlock tables;
connection con1;
reap;
drop table t5;
connection default;
disconnect con1;
disconnect con2;
remove_file $MYSQLTEST_VARDIR/tmp/t1.MYD;
remove_file $MYSQLTEST_VARDIR/tmp/t2.MYD;
remove_file $MYSQLTEST_VARDIR/tmp/t3.MYD;
remove_file $MYSQLTEST_VARDIR/tmp/t4.MYD;
remove_file $MYSQLTEST_VARDIR/tmp/t5.MYD;
remove_file $MYSQLTEST_VARDIR/tmp/t1.frm;
remove_file $MYSQLTEST_VARDIR/tmp/t2.frm;
remove_file $MYSQLTEST_VARDIR/tmp/t3.frm;
remove_file $MYSQLTEST_VARDIR/tmp/t4.frm;
remove_file $MYSQLTEST_VARDIR/tmp/t5.frm;
# End of 4.1 tests
# End of 5.0 tests
#
# Bug#18775 - Temporary table from alter table visible to other threads
#
# Backup did not encode table names.
--disable_warnings
DROP TABLE IF EXISTS `t+1`;
--enable_warnings
CREATE TABLE `t+1` (c1 INT);
INSERT INTO `t+1` VALUES (1), (2), (3);
BACKUP TABLE `t+1` TO '../../tmp';
DROP TABLE `t+1`;
#
# Same for restore.
RESTORE TABLE `t+1` FROM '../../tmp';
SELECT * FROM `t+1`;
DROP TABLE `t+1`;
#
remove_file $MYSQLTEST_VARDIR/tmp/t@002b1.frm;
remove_file $MYSQLTEST_VARDIR/tmp/t@002b1.MYD;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@@ -1,46 +0,0 @@
--source include/have_innodb.inc
--echo #
--echo # Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout
--echo # without error
--echo #
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b)) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES (1070109,99);
CREATE TABLE t2 (b int, a int, PRIMARY KEY (b)) ENGINE=InnoDB;
INSERT INTO t2 (b,a) VALUES (7,1070109);
SELECT * FROM t1;
BEGIN;
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
CONNECT (addconroot, localhost, root,,);
CONNECTION addconroot;
BEGIN;
--error ER_LOCK_WAIT_TIMEOUT
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
--error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 (a) VALUES ((SELECT a FROM t2 WHERE b=7));
--error ER_LOCK_WAIT_TIMEOUT
UPDATE t1 SET a='7000000' WHERE a=(SELECT a FROM t2 WHERE b=7);
--error ER_LOCK_WAIT_TIMEOUT
DELETE FROM t1 WHERE a=(SELECT a FROM t2 WHERE b=7);
SELECT * FROM t1;
CONNECTION default;
DISCONNECT addconroot;
DROP TABLE t2, t1;
--echo End of 5.0 tests

View File

@@ -0,0 +1 @@
--default-character-set=utf8 --skip-character-set-client-handshake

View File

@@ -0,0 +1,9 @@
# Embedded server doesn't support external clients
--source include/not_embedded.inc
--echo #
--echo # Bug#47671 - wrong character-set after upgrade from 5.1.34 to 5.1.39
--echo #
--echo # Extract only charset information from 'status' command output using regex
--replace_regex /.*mysql.*// /Connection.*// /Current.*// /SSL.*// /Using.*// /Server version.*// /Protocol.*// /UNIX.*// /Uptime.*// /Threads.*// /TCP.*//
--exec $MYSQL -e "status";

View File

@@ -1582,3 +1582,56 @@ create table t3 (a int) row_format=page;
--echo
--echo End of 5.1 tests
###########################################################################
--echo
--echo # --
--echo # -- Bug #43054 Assertion `!table->auto_increment_field_not_null'
--echo # -- failed when redefining trigger
--echo
#--disable_abort_on_error
CREATE TABLE B (
pk INTEGER AUTO_INCREMENT,
int_key INTEGER NOT NULL,
PRIMARY KEY (pk),
KEY (int_key)
);
INSERT IGNORE INTO B VALUES ('9', '9');
CREATE TABLE IF NOT EXISTS t1 (
`pk` INTEGER NOT NULL AUTO_INCREMENT ,
`int` INTEGER ,
PRIMARY KEY ( `pk` )
) SELECT `pk` , `int_key` FROM B ;
--delimiter |
CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
INSERT INTO t1 ( `int` ) VALUES (4 ),( 8 ),( 2 ) ;
END ; |
--delimiter ;
--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
CREATE TABLE IF NOT EXISTS t1 (
`pk` INTEGER NOT NULL AUTO_INCREMENT ,
`int` INTEGER ,
PRIMARY KEY ( `pk` )
) SELECT `pk` , `int_key` FROM B ;
--delimiter |
--error ER_NOT_SUPPORTED_YET
CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
UPDATE A SET `pk`=1 WHERE `pk`=0 ;
END ;|
--delimiter ;
DROP TABLE t1;
DROP TABLE B;

View File

@@ -1819,4 +1819,84 @@ repair table t1;
select * from t1 limit 1;
drop table t1;
#
# Bug #40814 CSV engine does not parse \X characters when they occur in unquoted fields
#
--echo #
--echo # Test for the following cases
--echo # 1) integers and strings enclosed in quotes
--echo # 2) integers and strings not enclosed in quotes
--echo # 3) \X characters with quotes
--echo # 4) \X characters outside quotes
--echo #
CREATE TABLE t1(c1 INT NOT NULL, c2 VARCHAR(50) NOT NULL) ENGINE=csv;
--echo # remove the already existing .CSV file if any
--remove_file $MYSQLD_DATADIR/test/t1.CSV
--echo # create the .CSV file that contains the hard-coded data used in
--echo # testing
--write_file $MYSQLD_DATADIR/test/t1.CSV
1,"integer sans quotes"
1,string sans quotes
1,quotes"in between" strings
"1",Integer with quote and string with no quote
1,"escape sequence \n \" \\ \r \a within quotes"
1,escape sequence \n \" \\ \r \a without quotes
EOF
--cat_file $MYSQLD_DATADIR/test/t1.CSV
--echo # select from the table in which the data has been filled in using
--echo # the hard-coded .CSV file
SELECT * FROM t1;
DROP TABLE t1;
--echo # Test for the case when a field begins with a quote, but does not end in a
--echo # quote.
--echo # Note: This results in an error.
CREATE TABLE t1(c1 INT NOT NULL, c2 VARCHAR(50) NOT NULL) ENGINE=csv;
--echo # remove the already existing .CSV file if any
--remove_file $MYSQLD_DATADIR/test/t1.CSV
--echo # create the .CSV file that contains the hard-coded data used in
--echo # testing
--write_file $MYSQLD_DATADIR/test/t1.CSV
1,"string only at the beginning quotes
EOF
--cat_file $MYSQLD_DATADIR/test/t1.CSV
--echo # select from the table in which the data has been filled in using
--echo # the hard-coded .CSV file
--error ER_CRASHED_ON_USAGE
SELECT * FROM t1;
DROP TABLE t1;
--echo # Test for the case when a field ends with a quote, but does not begin in a
--echo # quote.
--echo # Note: This results in an error.
CREATE TABLE t1(c1 INT NOT NULL, c2 VARCHAR(50) NOT NULL) ENGINE=csv;
--echo # remove the already existing .CSV file if any
--remove_file $MYSQLD_DATADIR/test/t1.CSV
--echo # create the .CSV file that contains the hard-coded data used in
--echo # testing
--write_file $MYSQLD_DATADIR/test/t1.CSV
1,string with only ending quotes"
EOF
--cat_file $MYSQLD_DATADIR/test/t1.CSV
--echo # select from the table in which the data has been filled in using
--echo # the hard-coded .CSV file
--error ER_CRASHED_ON_USAGE
SELECT * FROM t1;
DROP TABLE t1;
--echo End of 5.1 tests

View File

@@ -172,6 +172,18 @@ DROP TABLE t1;
#
# Test that optimizer doesn't use indexes with wrong collation
#
#
# BUG#48447, Delivering too few records with indexes using collate syntax
#
create table t1 (a varchar(1) character set latin1 collate latin1_general_ci);
insert into t1 values ('A'),('a'),('B'),('b'),('C'),('c');
select * from t1 where a > 'B' collate latin1_bin;
select * from t1 where a <> 'B' collate latin1_bin;
create index i on t1 (a);
select * from t1 where a > 'B' collate latin1_bin;
select * from t1 where a <> 'B' collate latin1_bin;
drop table t1;
SET NAMES latin1;
CREATE TABLE t1
(s1 char(10) COLLATE latin1_german1_ci,

View File

@@ -47,4 +47,14 @@ insert into t1 (a) values ('air'),
select * from t1 where a like 'we_%';
drop table t1;
#
# Bug#158 ENUM and SET types does not accept valid cp1251 character
#
CREATE TABLE t1 (
e1 enum('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'),
e2 enum('<27><><EFBFBD><EFBFBD><EFBFBD>')
) ENGINE=MYISAM character set cp1251;
SHOW CREATE TABLE t1;
DROP TABLE t1;
# End of 4.1 tests

View File

@@ -22,18 +22,18 @@ CALL bug18293("Foo's a Bar", _cp932 0xED40ED41ED42, 47.93)|
SELECT HEX(s1),HEX(s2),d FROM t4|
DROP PROCEDURE bug18293|
DROP TABLE t4|
SHOW BINLOG EVENTS FROM 370|
SHOW BINLOG EVENTS FROM 371|
delimiter ;|
--echo End of 5.0 tests
#
# #28436: Incorrect position in SHOW BINLOG EVENTS causes server coredump
# Note: 364 is a magic position (found experimentally, depends on
# Note: 365 is a magic position (found experimentally, depends on
# the log's contents) that caused the server crash.
--error 1220
SHOW BINLOG EVENTS FROM 365;
SHOW BINLOG EVENTS FROM 366;
--echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
CREATE TABLE t1 (a varchar(16)) character set cp932;

View File

@@ -4,11 +4,30 @@
drop table if exists t1;
--enable_warnings
--echo In the following tests we change the order of letter "b"
--echo making it equal to letter "a", and check that it works
--echo with all Unicode character sets
set names utf8;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
show variables like 'character_sets_dir%';
show collation like 'utf8_phone_ci';
CREATE TABLE t1 (
name VARCHAR(64),
phone VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_phone_ci
);
INSERT INTO t1 VALUES ('Svoj','+7 912 800 80 02');
INSERT INTO t1 VALUES ('Hf','+7 (912) 800 80 04');
INSERT INTO t1 VALUES ('Bar','+7-912-800-80-01');
INSERT INTO t1 VALUES ('Ramil','(7912) 800 80 03');
INSERT INTO t1 VALUES ('Sanja','+380 (912) 8008005');
SELECT * FROM t1 ORDER BY phone;
SELECT * FROM t1 WHERE phone='+7(912)800-80-01';
SELECT * FROM t1 WHERE phone='79128008001';
SELECT * FROM t1 WHERE phone='7 9 1 2 8 0 0 8 0 0 1';
DROP TABLE t1;
show collation like 'utf8_test_ci';
create table t1 (c1 char(1) character set utf8 collate utf8_test_ci);
insert into t1 values ('a');
@@ -37,6 +56,14 @@ UPDATE t1 SET col2=col1;
SELECT * FROM t1 WHERE col1=col2 ORDER BY col1;
DROP TABLE t1;
--echo #
--echo # Bug#45645 Mysql server close all connection and restart using lower function
--echo #
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8 COLLATE utf8_test_ci;
INSERT INTO t1 (a) VALUES ('hello!');
SELECT * FROM t1 WHERE LOWER(a)=LOWER('N');
DROP TABLE t1;
--echo #
--echo # Bug#43827 Server closes connections and restarts
--echo #
@@ -117,3 +144,11 @@ CREATE TABLE t1 (s1 char(10) character set utf8 collate utf8_maxuserid_ci);
INSERT INTO t1 VALUES ('a'),('b');
SELECT * FROM t1 WHERE s1='a' ORDER BY BINARY s1;
DROP TABLE t1;
#
# Bug#47756 Setting 2byte collation ID with 'set names' crashes the server
#
SET NAMES utf8 COLLATE utf8_phone_ci;
SHOW COLLATION LIKE 'utf8_phone_ci';
SET NAMES utf8;

View File

@@ -2,6 +2,8 @@
# Tests with the utf8 character set
#
--source include/have_innodb.inc
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
@@ -256,9 +258,7 @@ drop table t1;
# Bug 4521: unique key prefix interacts poorly with utf8
# InnoDB: keys with prefix compression, case insensitive collation.
#
--disable_warnings
create table t1 (c varchar(30) character set utf8, unique(c(10))) engine=innodb;
--enable_warnings
insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
insert into t1 values ('aaaaaaaaaa');
--error ER_DUP_ENTRY
@@ -306,9 +306,7 @@ drop table t1;
# Bug 4521: unique key prefix interacts poorly with utf8
# InnoDB: fixed length keys, case insensitive collation
#
--disable_warnings
create table t1 (c char(3) character set utf8, unique (c(2))) engine=innodb;
--enable_warnings
insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
insert into t1 values ('a');
insert into t1 values ('aa');
@@ -383,12 +381,10 @@ drop table t1;
# Bug 4531: unique key prefix interacts poorly with utf8
# Check BDB, case insensitive collation
#
--disable_warnings
create table t1 (
c char(10) character set utf8,
unique key a (c(1))
) engine=innodb;
--enable_warnings
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
--error ER_DUP_ENTRY
insert into t1 values ('aa');
@@ -506,12 +502,10 @@ drop table t1;
# Bug 4531: unique key prefix interacts poorly with utf8
# Check BDB, binary collation
#
--disable_warnings
create table t1 (
c char(10) character set utf8 collate utf8_bin,
unique key a (c(1))
) engine=innodb;
--enable_warnings
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
--error ER_DUP_ENTRY
insert into t1 values ('aa');
@@ -543,12 +537,10 @@ drop table t1;
# Bug#4594: column index make = failed for gbk, but like works
# Check InnoDB
#
--disable_warnings
create table t1 (
str varchar(255) character set utf8 not null,
key str (str(2))
) engine=innodb;
--enable_warnings
INSERT INTO t1 VALUES ('str');
INSERT INTO t1 VALUES ('str2');
select * from t1 where str='str';
@@ -581,12 +573,10 @@ drop table t1;
# the same for BDB
#
--disable_warnings
create table t1 (
str varchar(255) character set utf8 not null,
key str (str(2))
) engine=innodb;
--enable_warnings
INSERT INTO t1 VALUES ('str');
INSERT INTO t1 VALUES ('str2');
select * from t1 where str='str';
@@ -603,14 +593,11 @@ DROP TABLE t1;
#
# Bug #5723: length(<varchar utf8 field>) returns varying results
#
--disable_warnings
SET NAMES utf8;
--disable_warnings
CREATE TABLE t1 (
subject varchar(255) character set utf8 collate utf8_unicode_ci,
p varchar(15) character set utf8
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--enable_warnings
INSERT INTO t1 VALUES ('谷川俊二と申しますが、インターネット予約の会員登録をしましたところ、メールアドレスを間違えてしまい会員が受け取ることが出来ませんでした。間違えアドレスはtani-shun@n.vodafone.ne.jpを書き込みました。どうすればよいですか その他、住所等は間違えありません。連絡ください。よろしくお願いします。m(__)m','040312-000057');
INSERT INTO t1 VALUES ('aaa','bbb');
SELECT length(subject) FROM t1;
@@ -661,18 +648,14 @@ DROP TABLE t1;
# Bug #6019 SELECT tries to use too short prefix index on utf8 data
#
set names utf8;
--disable_warnings
create table t1 (
a int primary key,
b varchar(6),
index b3(b(3))
) engine=innodb character set=utf8;
--enable_warnings
insert into t1 values(1,'foo'),(2,'foobar');
select * from t1 where b like 'foob%';
--disable_warnings
alter table t1 engine=innodb;
--enable_warnings
select * from t1 where b like 'foob%';
drop table t1;
@@ -841,14 +824,12 @@ INSERT INTO t1 VALUES
(1,'blah','464','aaa','fkc1c9ilc20x0hgae7lx6j09','ERR','ERR Имри.Афимим.Аеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ад.Д имдимримрад.Адимримримрмдиримримримр м.Дадимфшьмримд им.Адимимрн имадми','ИМРИ.АФИМИМ.АЕИМИМРИМДМРИМРМРИРОР',3,'2005-06-01 17:30:43','1234567890'),
(2,'blah','464','aaa','haxpl2ilc20x00bj4tt2m5ti','11','11 g','G',3,'2005-06-02 22:43:10','1234567890');
--disable_warnings
CREATE TABLE t2 (
`msisdn` varchar(15) NOT NULL default '',
`operator_id` int(11) NOT NULL default '0',
`created` datetime NOT NULL default '0000-00-00 00:00:00',
UNIQUE KEY `PK_user` (`msisdn`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--enable_warnings
INSERT INTO t2 VALUES ('1234567890',2,'2005-05-24 13:53:25');
@@ -1013,10 +994,8 @@ drop table t1;
# additional tests from duplicate bug#20744 MySQL return no result
set names utf8;
--disable_warnings
create table t1 (a varchar(30) not null primary key)
engine=innodb default character set utf8 collate utf8_general_ci;
--enable_warnings
insert into t1 values ('あいうえおかきくけこさしすせそ');
insert into t1 values ('さしすせそかきくけこあいうえお');
select a as gci1 from t1 where a like 'さしすせそかきくけこあいうえお%';
@@ -1024,10 +1003,8 @@ select a as gci2 from t1 where a like 'あいうえおかきくけこさしす
drop table t1;
set names utf8;
--disable_warnings
create table t1 (a varchar(30) not null primary key)
engine=innodb default character set utf8 collate utf8_unicode_ci;
--enable_warnings
insert into t1 values ('あいうえおかきくけこさしすせそ');
insert into t1 values ('さしすせそかきくけこあいうえお');
select a as uci1 from t1 where a like 'さしすせそかきくけこあいうえお%';
@@ -1035,10 +1012,8 @@ select a as uci2 from t1 where a like 'あいうえおかきくけこさしす
drop table t1;
set names utf8;
--disable_warnings
create table t1 (a varchar(30) not null primary key)
engine=innodb default character set utf8 collate utf8_bin;
--enable_warnings
insert into t1 values ('あいうえおかきくけこさしすせそ');
insert into t1 values ('さしすせそかきくけこあいうえお');
select a as bin1 from t1 where a like 'さしすせそかきくけこあいうえお%';
@@ -1363,26 +1338,22 @@ select concat(a, if(b>10, 'x' 'x', 'y' 'y')) from t1;
select concat(a, if(b>10, 'x' 'æ', 'y' 'ß')) from t1;
drop table t1;
#
# Bug#19960: Inconsistent results when joining
# InnoDB tables using partial UTF8 indexes
#
--disable_warnings
CREATE TABLE t1 (
colA int(11) NOT NULL,
colB varchar(255) character set utf8 NOT NULL,
PRIMARY KEY (colA)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--enable_warnings
INSERT INTO t1 (colA, colB) VALUES (1, 'foo'), (2, 'foo bar');
--disable_warnings
CREATE TABLE t2 (
colA int(11) NOT NULL,
colB varchar(255) character set utf8 NOT NULL,
KEY bad (colA,colB(3))
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--enable_warnings
INSERT INTO t2 (colA, colB) VALUES (1, 'foo'),(2, 'foo bar');
SELECT * FROM t1 JOIN t2 ON t1.colA=t2.colA AND t1.colB=t2.colB
WHERE t1.colA < 3;
@@ -1459,6 +1430,19 @@ DROP TABLE t1;
--echo Start of 5.4 tests
#
# Bug#26180: Can't add columns to tables created with utf8 text indexes
#
CREATE TABLE t1 (
clipid INT NOT NULL,
Tape TINYTEXT,
PRIMARY KEY (clipid),
KEY tape(Tape(255))
) CHARACTER SET=utf8;
ALTER TABLE t1 ADD mos TINYINT DEFAULT 0 AFTER clipid;
SHOW CREATE TABLE t1;
DROP TABLE t1;
#
# Bug#26474: Add Sinhala script (Sri Lanka) collation to MySQL
#

View File

@@ -247,7 +247,7 @@ DROP TABLE t1;
# Bug #32676: insert delayed crash with wrong column and function specified
#
CREATE TABLE t1 (a INT);
--error ER_BAD_FIELD_ERROR
--error 1305
INSERT DELAYED INTO t1 SET b= b();
DROP TABLE t1;
@@ -328,4 +328,63 @@ drop table t1;
set global low_priority_updates = @old_delayed_updates;
--echo #
--echo # Bug #47682 strange behaviour of INSERT DELAYED
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
CREATE TABLE t1 (f1 integer);
CREATE TABLE t2 (f1 integer);
FLUSH TABLES WITH READ LOCK;
LOCK TABLES t1 READ;
# ER_CANT_UPDATE_WITH_READLOCK with normal execution
# ER_TABLE_NOT_LOCKED when executed as prepared statement
--error ER_CANT_UPDATE_WITH_READLOCK, ER_TABLE_NOT_LOCKED
INSERT DELAYED INTO t2 VALUES (1);
UNLOCK TABLES;
DROP TABLE t1, t2;
--echo End of 5.1 tests
--echo #
--echo # Bug #47274 assert in open_table on CREATE TABLE <already existing>
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
--enable_warnings
CREATE TABLE t1 ( f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1));
--echo # The following CREATE TABLEs before gave an assert.
INSERT DELAYED t1 VALUES (4);
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE t1 AS SELECT 1 AS f1;
REPLACE DELAYED t1 VALUES (5);
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE t1 AS SELECT 1 AS f1;
INSERT DELAYED t1 VALUES (6);
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE t1 (f1 INTEGER);
CREATE TABLE t2 (f1 INTEGER);
INSERT DELAYED t1 VALUES (7);
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE t1 LIKE t2;
DROP TABLE t2;
DROP TABLE t1;

View File

@@ -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
@@ -336,3 +489,25 @@ SELECT * FROM t2;
SELECT * FROM t3;
DROP TABLE t1, t2, t3;
--echo #
--echo # Bug #46425 crash in Diagnostics_area::set_ok_status,
--echo # empty statement, DELETE IGNORE
--echo #
CREATE table t1 (i INTEGER);
INSERT INTO t1 VALUES (1);
--delimiter |
CREATE TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW
BEGIN
INSERT INTO t1 SELECT * FROM t1 AS A;
END |
--delimiter ;
--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
DELETE IGNORE FROM t1;
DROP TABLE t1;

View File

@@ -0,0 +1,27 @@
--error ER_UNKNOWN_SYSTEM_VARIABLE
set global log_bin_trust_routine_creators=1;
--error ER_UNKNOWN_SYSTEM_VARIABLE
set table_type='MyISAM';
--error ER_UNKNOWN_SYSTEM_VARIABLE
select @@table_type='MyISAM';
--error ER_PARSE_ERROR
backup table t1 to 'data.txt';
--error ER_PARSE_ERROR
restore table t1 from 'data.txt';
--error ER_PARSE_ERROR
show plugin;
--error ER_PARSE_ERROR
load table t1 from master;
--error ER_PARSE_ERROR
load data from master;
--error ER_PARSE_ERROR
SHOW INNODB STATUS;
--error ER_PARSE_ERROR
create table t1 (t6 timestamp(6));
--error ER_PARSE_ERROR
create table t1 (t6 timestamp) type=myisam;
--error ER_PARSE_ERROR
show table types;
--error ER_PARSE_ERROR
show mutex status;

View File

@@ -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;

View File

@@ -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

View File

@@ -10,8 +10,7 @@
#
##############################################################################
kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
innodb_bug39438 : Bug#42383 2009-01-28 lsoares "This fails in embedded and on windows. Note that this test is not run on windows and on embedded in PB for main trees currently"
query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
partition_innodb_builtin : Bug#32430 2009-09-25 mattiasj Waiting for push of Innodb changes
partition_innodb_plugin : Bug#32430 2009-09-25 mattiasj Waiting for push of Innodb changes
innodb_bug46000 : Bug#47860 2009-10-16 satyab Test fails for innodb plugin 1.0.5
rpl_killed_ddl : Bug#45520: rpl_killed_ddl fails sporadically in pb2
innodb-autoinc : Bug#49267 2009-12-02 test fails on windows because of different case mode
innodb : Bug#49396 2009-12-03 test fails in embedded mode

View File

@@ -0,0 +1,85 @@
# This test uses chmod, can't be run with root permissions
--source include/not_as_root.inc
###########################################################################
--echo
--echo # --
--echo # -- Bug#26704: Failing DROP DATABASE brings mysql-client out of sync.
--echo # --
--echo
--disable_warnings
DROP DATABASE IF EXISTS mysql_test;
--enable_warnings
--echo
CREATE DATABASE mysql_test;
CREATE TABLE mysql_test.t1(c INT);
use mysql_test;
let $MYSQLD_DATADIR= `select @@datadir`;
--echo
--echo chmod 000 mysql_test/t1.frm
--chmod 0000 $MYSQLD_DATADIR/mysql_test/t1.frm
# NOTE: For the DROP DATABASE below we need:
# - disable result log because ER_DB_DROP_RMDIR contains errno, which can be
# different on different platforms.
# - expect different error codes, because Windows and UNIX behaves
# differently (see below).
#
# NOTE: Windows and UNIX behaves differently in this test case:
#
# - on UNIX when t1.frm is chmoded to 000, it is perfectly deleted
# by the first DROP DATABASE, but some other files (t1.MYI and t1.MYD) left
# in the directory. So, we have to explicitly removes them before the
# second DROP DATABASE.
#
# - on Windows when t1.frm is chmoded to 000, it is not deleted by the first
# DROP DATABASE, but all other files in the database directory are deleted.
# Thus, we have to change the t1.frm permissions again and delete it
# explicitly before the second DROP DATABASE.
#
# All those differences do not really matter for the idea of this test case:
# checking that if DROP DATABASE failed, the client is Ok.
--echo
--disable_result_log
--error ER_DB_DROP_RMDIR,6
DROP DATABASE mysql_test;
--enable_result_log
--echo
SELECT DATABASE();
# Remove t1.MYI and t1.MYD. On UNIX it should succeed. On Windows, it fails.
--echo
--echo rm -f mysql_test/t1.MYD mysql_test/t1.MYI
--error 0, 1
--remove_file $MYSQLD_DATADIR/mysql_test/t1.MYD
--error 0, 1
--remove_file $MYSQLD_DATADIR/mysql_test/t1.MYI
# Make t1.frm removable: fail on UNIX, succeed on Windows.
--echo chmod 666 mysql_test/t1.frm
--error 0, 1
--chmod 0666 $MYSQLD_DATADIR/mysql_test/t1.frm
# Remove t1.frm: fail on UNIX, succeed on Windows.
--echo rm -f mysql_test/t1.frm
--error 0, 1
--remove_file $MYSQLD_DATADIR/mysql_test/t1.frm
--echo
DROP DATABASE mysql_test;
--echo
use test;
--echo
--echo # -- End of Bug#26704.
###########################################################################

View File

@@ -124,6 +124,39 @@ disconnect addconroot1;
--source include/wait_until_disconnected.inc
connection default;
#
# Bug#25858 Some DROP TABLE under LOCK TABLES can cause deadlocks
#
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
create table t1 (a int);
create table t2 (a int);
lock table t1 read;
--error ER_TABLE_NOT_LOCKED
drop table t2;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
drop table t1;
unlock tables;
drop table t1,t2;
connect (addconroot, localhost, root,,);
connection default;
create table t1 (i int);
create table t2 (i int);
lock tables t1 read;
connection addconroot;
lock tables t2 read;
--error ER_TABLE_NOT_LOCKED
drop table t1;
connection default;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
drop table t1,t2;
disconnect addconroot;
connection default;
unlock tables;
drop table t1,t2;
--echo End of 5.0 tests
#
@@ -202,3 +235,24 @@ use test;
drop database mysqltestbug26703;
--echo End of 5.1 tests
###########################################################################
--echo
--echo # --
--echo # -- Bug#37431 (DROP TABLE does not report errors correctly).
--echo # --
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
--error ER_BAD_TABLE_ERROR
DROP TABLE t1;
SHOW WARNINGS;
--echo
--echo # --
--echo # -- End of Bug#37431.
--echo # --

View File

@@ -0,0 +1,35 @@
#
# DROP-related tests which execution requires debug server.
#
--source include/have_debug.inc
###########################################################################
--echo
--echo # --
--echo # -- Bug#43138: DROP DATABASE failure does not clean up message list.
--echo # --
--echo
--disable_warnings
DROP DATABASE IF EXISTS mysql_test;
--enable_warnings
--echo
CREATE DATABASE mysql_test;
CREATE TABLE mysql_test.t1(a INT);
--echo
SET SESSION DEBUG = "+d,bug43138";
--echo
DROP DATABASE mysql_test;
--echo
SET SESSION DEBUG = "-d,bug43138";
--echo
--echo # --
--echo # -- End of Bug#43138.
--echo # --
###########################################################################

View File

@@ -68,6 +68,40 @@ INSERT INTO t1 SELECT b FROM t1;
DROP TABLE t1;
# End of 5.0 tests
flush status;
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
create table t1 (a int unique);
create table t2 (a int);
drop function if exists f1;
drop function if exists f2;
delimiter |;
create function f1() returns int
begin
insert into t1 (a) values (1);
insert into t1 (a) values (1);
return 1;
end|
create function f2() returns int
begin
insert into t2 (a) values (1);
return 2;
end|
delimiter ;|
flush status;
--error 1062
select f1(), f2();
show status like 'Com_insert';
select * from t1;
select * from t2;
drop table t1;
drop table t2;
drop function f1;
drop function f2;
#
# testing the value encoding in the error messages of set_var
#

View File

@@ -167,4 +167,36 @@ flush tables;
SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' );
drop tables t1, t2;
--echo #
--echo # Bug#48295:
--echo # explain extended crash with subquery and ONLY_FULL_GROUP_BY sql_mode
--echo #
CREATE TABLE t1 (f1 INT);
SELECT @@session.sql_mode INTO @old_sql_mode;
SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
# EXPLAIN EXTENDED (with subselect). used to crash. should give NOTICE.
--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
EXPLAIN EXTENDED SELECT 1 FROM t1
WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t );
SHOW WARNINGS;
SET SESSION sql_mode=@old_sql_mode;
DROP TABLE t1;
--echo #
--echo # Bug#30302: Tables that were optimized away are printed in the
--echo # EXPLAIN EXTENDED warning.
--echo #
create table t1(f1 int);
create table t2(f2 int);
insert into t1 values(1);
insert into t2 values(1),(2);
explain extended select * from t1 where f1=1;
explain extended select * from t1 join t2 on f1=f2 where f1=1;
drop table t1,t2;
--echo End of 5.1 tests.

View File

@@ -57,7 +57,7 @@ connection con1;
# debug build running without our --debug=make_global..., will be
# error 0 (no error). The only important thing to test is that on
# debug builds with our --debug=make_global... we don't hang forever.
--error 0,1053,2013
--error 0,1317,2013
reap;
connection con2;

View File

@@ -419,6 +419,15 @@ DROP TABLE t1;
# End of 4.1 tests
#
# bug#34374 - mysql generates incorrect warning
#
create table t1(a text,b date,fulltext index(a))engine=myisam;
insert into t1 set a='water',b='2008-08-04';
select 1 from t1 where match(a) against ('water' in boolean mode) and b>='2008-08-01';
drop table t1;
show warnings;
#
# BUG#38842 - Fix for 25951 seems incorrect
#
@@ -484,3 +493,44 @@ PREPARE s FROM
EXECUTE s;
DEALLOCATE PREPARE s;
DROP TABLE t1;
--echo #
--echo # Bug #47930: MATCH IN BOOLEAN MODE returns too many results
--echo # inside subquery
--echo #
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1), (2);
CREATE TABLE t2 (a int, b2 char(10), FULLTEXT KEY b2 (b2));
INSERT INTO t2 VALUES (1,'Scargill');
CREATE TABLE t3 (a int, b int);
INSERT INTO t3 VALUES (1,1), (2,1);
--echo # t2 should use full text index
EXPLAIN
SELECT count(*) FROM t1 WHERE
not exists(
SELECT 1 FROM t2, t3
WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
);
--echo # should return 0
SELECT count(*) FROM t1 WHERE
not exists(
SELECT 1 FROM t2, t3
WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
);
--echo # should return 0
SELECT count(*) FROM t1 WHERE
not exists(
SELECT 1 FROM t2 IGNORE INDEX (b2), t3
WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
);
DROP TABLE t1,t2,t3;
--echo End of 5.1 tests

View File

@@ -1053,4 +1053,35 @@ ORDER BY max;
--echo #
DROP TABLE t1;
--echo #
--echo # Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
--echo #
create table t1 (f1 year(2), f2 year(4), f3 date, f4 datetime);
insert into t1 values
(98,1998,19980101,"1998-01-01 00:00:00"),
(00,2000,20000101,"2000-01-01 00:00:01"),
(02,2002,20020101,"2002-01-01 23:59:59"),
(60,2060,20600101,"2060-01-01 11:11:11"),
(70,1970,19700101,"1970-11-11 22:22:22"),
(NULL,NULL,NULL,NULL);
select min(f1),max(f1) from t1;
select min(f2),max(f2) from t1;
select min(f3),max(f3) from t1;
select min(f4),max(f4) from t1;
select a.f1 as a, b.f1 as b, a.f1 > b.f1 as gt,
a.f1 < b.f1 as lt, a.f1<=>b.f1 as eq
from t1 a, t1 b;
select a.f1 as a, b.f2 as b, a.f1 > b.f2 as gt,
a.f1 < b.f2 as lt, a.f1<=>b.f2 as eq
from t1 a, t1 b;
select a.f1 as a, b.f3 as b, a.f1 > b.f3 as gt,
a.f1 < b.f3 as lt, a.f1<=>b.f3 as eq
from t1 a, t1 b;
select a.f1 as a, b.f4 as b, a.f1 > b.f4 as gt,
a.f1 < b.f4 as lt, a.f1<=>b.f4 as eq
from t1 a, t1 b;
select *, f1 = f2 from t1;
drop table t1;
--echo #
--echo End of 5.1 tests

View File

@@ -13,3 +13,15 @@ select * from t1 where isnull(to_days(mydate));
drop table t1;
# End of 4.1 tests
#
# Bug #41371 Select returns 1 row with condition "col is not null and col is null"
#
CREATE TABLE t1 (id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY(id));
INSERT INTO t1( id ) VALUES ( NULL );
SELECT t1.id FROM t1 WHERE (id is not null and id is null );
DROP TABLE t1;
# End of 5.1 tests

View File

@@ -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

View File

@@ -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

View File

@@ -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
#

View File

@@ -881,4 +881,25 @@ SELECT COUNT(*) FROM t1 IGNORE INDEX (b) WHERE
DROP TABLE t1;
--echo #
--echo # Bug #48258: Assertion failed when using a spatial index
--echo #
CREATE TABLE t1(a LINESTRING NOT NULL, SPATIAL KEY(a));
INSERT INTO t1 VALUES
(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')),
(GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'));
EXPLAIN SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
EXPLAIN SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
EXPLAIN SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
EXPLAIN SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
EXPLAIN SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
DROP TABLE t1;
--echo End of 5.0 tests.

View File

@@ -655,6 +655,22 @@ insert into t1 values (),(),();
select min(`col002`) from t1 union select `col002` from t1;
drop table t1;
--echo #
--echo # Bug #47780: crash when comparing GIS items from subquery
--echo #
CREATE TABLE t1(a INT, b MULTIPOLYGON);
INSERT INTO t1 VALUES
(0,
GEOMFROMTEXT(
'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))'));
--echo # must not crash
SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1);
DROP TABLE t1;
--echo End of 5.0 tests

View File

@@ -1525,5 +1525,357 @@ DROP USER 'user1'@'localhost';
DROP USER 'user2';
DROP DATABASE db1;
--echo #
--echo # Bug #25863 No database selected error, but documentation
--echo # says * for global allowed
--echo #
connect(conn1,localhost,root,,*NO-ONE*);
--error ER_NO_DB_ERROR
GRANT ALL ON * TO mysqltest_1;
GRANT ALL ON *.* TO mysqltest_1;
SHOW GRANTS FOR mysqltest_1;
DROP USER mysqltest_1;
USE test;
GRANT ALL ON * TO mysqltest_1;
SHOW GRANTS FOR mysqltest_1;
DROP USER mysqltest_1;
GRANT ALL ON *.* TO mysqltest_1;
SHOW GRANTS FOR mysqltest_1;
DROP USER mysqltest_1;
connection default;
disconnect conn1;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
--echo #########################################################################
--echo #
--echo # Bug#38347: ALTER ROUTINE privilege allows SHOW CREATE TABLE.
--echo #
--echo #########################################################################
--echo
--echo # --
--echo # -- Prepare the environment.
--echo # --
DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%';
DELETE FROM mysql.db WHERE User LIKE 'mysqltest_%';
DELETE FROM mysql.tables_priv WHERE User LIKE 'mysqltest_%';
DELETE FROM mysql.columns_priv WHERE User LIKE 'mysqltest_%';
FLUSH PRIVILEGES;
--disable_warnings
DROP DATABASE IF EXISTS mysqltest_db1;
--enable_warnings
CREATE DATABASE mysqltest_db1;
CREATE TABLE mysqltest_db1.t1(a INT);
--echo
--echo # --
--echo # -- Check that global privileges don't allow SHOW CREATE TABLE.
--echo # --
GRANT EVENT ON mysqltest_db1.* TO mysqltest_u1@localhost;
GRANT CREATE TEMPORARY TABLES ON mysqltest_db1.* TO mysqltest_u1@localhost;
GRANT LOCK TABLES ON mysqltest_db1.* TO mysqltest_u1@localhost;
GRANT ALTER ROUTINE ON mysqltest_db1.* TO mysqltest_u1@localhost;
GRANT CREATE ROUTINE ON mysqltest_db1.* TO mysqltest_u1@localhost;
GRANT EXECUTE ON mysqltest_db1.* TO mysqltest_u1@localhost;
GRANT FILE ON *.* TO mysqltest_u1@localhost;
GRANT CREATE USER ON *.* TO mysqltest_u1@localhost;
GRANT PROCESS ON *.* TO mysqltest_u1@localhost;
GRANT RELOAD ON *.* TO mysqltest_u1@localhost;
GRANT REPLICATION CLIENT ON *.* TO mysqltest_u1@localhost;
GRANT REPLICATION SLAVE ON *.* TO mysqltest_u1@localhost;
GRANT SHOW DATABASES ON *.* TO mysqltest_u1@localhost;
GRANT SHUTDOWN ON *.* TO mysqltest_u1@localhost;
GRANT USAGE ON *.* TO mysqltest_u1@localhost;
--echo
SHOW GRANTS FOR mysqltest_u1@localhost;
--echo
--echo # connection: con1 (mysqltest_u1@mysqltest_db1)
--connect (con1,localhost,mysqltest_u1,,mysqltest_db1)
--connection con1
--echo
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE t1;
--echo
--echo # connection: default
--connection default
--disconnect con1
--echo
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
SHOW GRANTS FOR mysqltest_u1@localhost;
--echo
--echo # --
--echo # -- Check that global SELECT allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT SELECT ON mysqltest_db1.* TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that global INSERT allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT INSERT ON mysqltest_db1.* TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that global UPDATE allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT UPDATE ON mysqltest_db1.* TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that global DELETE allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT DELETE ON mysqltest_db1.* TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that global CREATE allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT CREATE ON mysqltest_db1.* TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that global DROP allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT DROP ON mysqltest_db1.* TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that global ALTER allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT ALTER ON mysqltest_db1.* TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that global INDEX allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT INDEX ON mysqltest_db1.* TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that global REFERENCES allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT REFERENCES ON mysqltest_db1.* TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that global GRANT OPTION allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT GRANT OPTION ON mysqltest_db1.* TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that global CREATE VIEW allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT CREATE VIEW ON mysqltest_db1.* TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that global SHOW VIEW allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT SHOW VIEW ON mysqltest_db1.* TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that table-level SELECT allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that table-level INSERT allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT INSERT ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that table-level UPDATE allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT UPDATE ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that table-level DELETE allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT DELETE ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that table-level CREATE allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT CREATE ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that table-level DROP allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT DROP ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that table-level ALTER allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT ALTER ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that table-level INDEX allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT INDEX ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that table-level REFERENCES allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT REFERENCES ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that table-level GRANT OPTION allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT GRANT OPTION ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that table-level CREATE VIEW allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT CREATE VIEW ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Check that table-level SHOW VIEW allows SHOW CREATE TABLE.
--echo # --
--echo
GRANT SHOW VIEW ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
--source include/bug38347.inc
--echo
--echo # --
--echo # -- Cleanup.
--echo # --
--echo
DROP DATABASE mysqltest_db1;
DROP USER mysqltest_u1@localhost;
--echo
--echo # End of Bug#38347.
--echo

View File

@@ -632,5 +632,40 @@ DROP DATABASE db1;
--echo End of 5.0 tests
#
# Bug #48319: Server crashes on "GRANT/REVOKE ... TO CURRENT_USER"
#
# work out who we are.
USE mysql;
SELECT LEFT(CURRENT_USER(),INSTR(CURRENT_USER(),'@')-1) INTO @u;
SELECT MID(CURRENT_USER(),INSTR(CURRENT_USER(),'@')+1) INTO @h;
SELECT password FROM user WHERE user=@u AND host=@h INTO @pwd;
# show current privs.
SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
# toggle INSERT
UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h;
SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
# show that GRANT ... TO CURRENT_USER() no longer crashes
GRANT INSERT ON *.* TO CURRENT_USER();
SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h;
# show that GRANT ... TO CURRENT_USER() IDENTIFIED BY ... works now
GRANT INSERT ON *.* TO CURRENT_USER() IDENTIFIED BY 'keksdose';
SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
UPDATE user SET password=@pwd WHERE user=@u AND host=@h;
SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
FLUSH PRIVILEGES;
USE test;
--echo End of 5.1 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@@ -163,6 +163,41 @@ connection default;
DROP USER 'mysqltest1'@'%';
DROP DATABASE mysqltest_1;
--echo #
--echo # Bug#41597 - After rename of user, there are additional grants
--echo # when grants are reapplied.
--echo #
CREATE DATABASE temp;
CREATE TABLE temp.t1(a INT, b VARCHAR(10));
INSERT INTO temp.t1 VALUES(1, 'name1');
INSERT INTO temp.t1 VALUES(2, 'name2');
INSERT INTO temp.t1 VALUES(3, 'name3');
CREATE USER 'user1'@'%';
RENAME USER 'user1'@'%' TO 'user2'@'%';
--echo # Show privileges after rename and BEFORE grant
SHOW GRANTS FOR 'user2'@'%';
GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%';
--echo # Show privileges after rename and grant
SHOW GRANTS FOR 'user2'@'%';
--echo # Connect as the renamed user
connect (conn1, localhost, user2,,);
connection conn1;
SHOW GRANTS;
SELECT a FROM temp.t1;
--echo # Check for additional privileges by accessing a
--echo # non privileged column. We shouldn't be able to
--echo # access this column.
--error ER_COLUMNACCESS_DENIED_ERROR
SELECT b FROM temp.t1;
disconnect conn1;
connection default;
DROP USER 'user2'@'%';
DROP DATABASE temp;
--echo End of 5.0 tests

146
mysql-test/t/grant4.test Normal file
View File

@@ -0,0 +1,146 @@
--source include/not_embedded.inc
# Setup database, tables and user accounts
--disable_warnings
drop database if exists mysqltest_db1;
--enable_warnings
create database mysqltest_db1;
use mysqltest_db1;
create table t_column_priv_only (a int, b int);
create table t_select_priv like t_column_priv_only;
create table t_no_priv like t_column_priv_only;
grant all privileges on test.* to mysqltest_u1@localhost;
grant insert (a) on mysqltest_db1.t_column_priv_only to mysqltest_u1@localhost;
grant select on mysqltest_db1.t_select_priv to mysqltest_u1@localhost;
--echo ** Connect as restricted user mysqltest_u1.
--echo
connect (con1,localhost,mysqltest_u1,,);
connection con1;
########################################################################
--echo ** Test column level privileges only. No SELECT privileges on the table.
--echo ** INSERT INTO ... VALUES ...
--echo ** Attempting to insert values to a table with only column privileges
--echo ** should work.
insert into mysqltest_db1.t_column_priv_only (a) VALUES (1);
--echo
#########################################################################
--echo ** SHOW COLUMNS
--echo ** Should succeed because we have privileges (any) on at least one of the columns.
select column_name as 'Field',column_type as 'Type',is_nullable as 'Null',column_key as 'Key',column_default as 'Default',extra as 'Extra' from information_schema.columns where table_schema='mysqltest_db1' and table_name='t_column_priv_only';
show columns from mysqltest_db1.t_column_priv_only;
#########################################################################
--echo ** SHOW COLUMNS
--echo ** Should fail because there are no privileges on any column combination.
--error 1142
show columns from mysqltest_db1.t_no_priv;
--echo ** However, select from I_S.COLUMNS will succeed but not show anything:
select column_name as 'Field',column_type as 'Type',is_nullable as 'Null',column_key as 'Key',column_default as 'Default',extra as 'Extra' from information_schema.columns where table_schema='mysqltest_db1' and table_name='t_no_priv';
--echo
#########################################################################
--echo ** CREATE TABLE ... LIKE ... require SELECT privleges and will fail.
--error 1142
create table test.t_no_priv like mysqltest_db1.column_priv_only;
--echo
#########################################################################
--echo ** Just to be sure... SELECT also fails.
--error 1142
select * from mysqltest_db1.t_column_priv_only;
--echo
#########################################################################
--echo ** SHOW CREATE TABLE ... require any privileges on all columns (the entire table).
--echo ** First we try and fail on a table with only one column privilege.
--error 1142
show create table mysqltest_db1.t_column_priv_only;
--echo
#########################################################################
--echo ** Now we do the same on a table with SELECT privileges.
--echo
#########################################################################
--echo ** SHOW COLUMNS
--echo ** Success because we got some privileges on the table (SELECT_ACL)
show columns from mysqltest_db1.t_select_priv;
--echo
#########################################################################
--echo ** CREATE TABLE ... LIKE ... require SELECT privleges and will SUCCEED.
--disable_warnings
drop table if exists test.t_duplicated;
--enable_warnings
create table test.t_duplicated like mysqltest_db1.t_select_priv;
drop table test.t_duplicated;
--echo
#########################################################################
--echo ** SHOW CREATE TABLE will succeed because we have a privilege on all columns in the table (table-level privilege).
show create table mysqltest_db1.t_select_priv;
--echo
#########################################################################
--echo ** SHOW CREATE TABLE will fail if there is no grants at all:
--error 1142
show create table mysqltest_db1.t_no_priv;
--echo
connection default;
#
# SHOW INDEX
#
use mysqltest_db1;
CREATE TABLE t5 (s1 INT);
CREATE INDEX i ON t5 (s1);
CREATE TABLE t6 (s1 INT, s2 INT);
CREATE VIEW v5 AS SELECT * FROM t5;
CREATE VIEW v6 AS SELECT * FROM t6;
CREATE VIEW v2 AS SELECT * FROM t_select_priv;
CREATE VIEW v3 AS SELECT * FROM t_select_priv;
CREATE INDEX i ON t6 (s1);
GRANT UPDATE (s2) ON t6 to mysqltest_u1@localhost;
GRANT UPDATE (s2) ON v6 to mysqltest_u1@localhost;
GRANT SHOW VIEW ON v2 to mysqltest_u1@localhost;
GRANT SHOW VIEW, SELECT ON v3 to mysqltest_u1@localhost;
connection con1;
use mysqltest_db1;
--echo ** Connect as restricted user mysqltest_u1.
--echo ** SELECT FROM INFORMATION_SCHEMA.STATISTICS will succeed because any privileges will do (authentication is enough).
#
# this result is wrong. reported as bug#34104
#
SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE table_name='t5';
#
# Bug27145 EXTRA_ACL trouble
#
--echo ** SHOW INDEX FROM t5 will fail because we don't have any privileges on any column combination.
--error 1142
SHOW INDEX FROM t5;
--echo ** SHOW INDEX FROM t6 will succeed because there exist a privilege on a column combination on t6.
SHOW INDEX FROM t6;
# CHECK TABLE
--echo ** CHECK TABLE requires any privilege on any column combination and should succeed for t6:
CHECK TABLE t6;
--echo ** With no privileges access is naturally denied:
--error 1142
CHECK TABLE t5;
# CHECKSUM
--echo ** CHECKSUM TABLE requires SELECT privileges on the table. The following should fail:
--error 1142
CHECKSUM TABLE t6;
--echo ** And this should work:
CHECKSUM TABLE t_select_priv;
# SHOW CREATE VIEW
--error 1142
SHOW CREATE VIEW v5;
--error 1142
SHOW CREATE VIEW v6;
--error 1142
SHOW CREATE VIEW v2;
SHOW CREATE VIEW v3;
connection default;
disconnect con1;
drop database mysqltest_db1;
drop user mysqltest_u1@localhost;

View File

@@ -0,0 +1,30 @@
-- source include/have_case_insensitive_fs.inc
-- source include/not_embedded.inc
#
# Bug#41049 does syntax "grant" case insensitive?
#
create database db1;
GRANT CREATE ON db1.* to user_1@localhost;
GRANT SELECT ON db1.* to USER_1@localhost;
connect (con1,localhost,user_1,,db1);
CREATE TABLE t1(f1 int);
--error 1142
SELECT * FROM t1;
connect (con2,localhost,USER_1,,db1);
SELECT * FROM t1;
--error 1142
CREATE TABLE t2(f1 int);
connection default;
disconnect con1;
disconnect con2;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
DROP USER user_1@localhost;
DROP USER USER_1@localhost;
DROP DATABASE db1;
use test;

View File

@@ -120,8 +120,9 @@ SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2
SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY NULL;
SELECT HIGH_PRIORITY cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY surname, firstname;
drop table t1,t2;
drop table t2;
unlock tables;
drop table t1;
#
# Test of group by bug in bugzilla

View File

@@ -1016,6 +1016,18 @@ SELECT a, MAX(b) FROM t WHERE b > 0 AND b < 2 GROUP BY a;
DROP TABLE t;
--echo #
--echo # Bug #48472: Loose index scan inappropriately chosen for some WHERE
--echo # conditions
--echo #
CREATE TABLE t (a INT, b INT, INDEX (a,b));
INSERT INTO t VALUES (2,0), (2,0), (2,1), (2,1);
INSERT INTO t SELECT * FROM t;
SELECT a, MAX(b) FROM t WHERE 0=b+0 GROUP BY a;
DROP TABLE t;
--echo End of 5.0 tests

View File

@@ -366,7 +366,7 @@ show tables from information_schema like "T%";
create database information_schema;
use information_schema;
show full tables like "T%";
--error ER_UNKNOWN_TABLE
--error ER_DBACCESS_DENIED_ERROR
create table t1(a int);
use test;
show tables;
@@ -1391,6 +1391,65 @@ SET TIMESTAMP=DEFAULT;
--echo End of 5.1 tests.
#
# Bug#24062 Incorrect error msg after execute DROP TABLE IF EXISTS on information_schema
#
--error ER_DBACCESS_DENIED_ERROR
create table information_schema.t1 (f1 INT);
--error ER_DBACCESS_DENIED_ERROR
drop table information_schema.t1;
--error ER_DBACCESS_DENIED_ERROR
drop temporary table if exists information_schema.t1;
--error ER_DBACCESS_DENIED_ERROR
create temporary table information_schema.t1 (f1 INT);
--error ER_DBACCESS_DENIED_ERROR
drop view information_schema.v1;
--error ER_DBACCESS_DENIED_ERROR
create view information_schema.v1;
--error ER_DBACCESS_DENIED_ERROR
create trigger mysql.trg1 after insert on information_schema.t1 for each row set @a=1;
--error 1109
create table t1 select * from information_schema.t1;
CREATE TABLE t1(f1 char(100));
--error ER_DBACCESS_DENIED_ERROR
REPAIR TABLE t1, information_schema.tables;
CHECKSUM TABLE t1, information_schema.tables;
--error ER_DBACCESS_DENIED_ERROR
ANALYZE TABLE t1, information_schema.tables;
CHECK TABLE t1, information_schema.tables;
--error ER_DBACCESS_DENIED_ERROR
OPTIMIZE TABLE t1, information_schema.tables;
--error ER_DBACCESS_DENIED_ERROR
RENAME TABLE v1 to v2, information_schema.tables to t2;
--error ER_DBACCESS_DENIED_ERROR
DROP TABLE t1, information_schema.tables;
--error ER_DBACCESS_DENIED_ERROR
LOCK TABLES t1 READ, information_schema.tables READ;
DROP TABLE t1;
#
# Bug#39270 I_S optimization algorithm does not work properly in some cases
#
EXPLAIN SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE;
EXPLAIN SELECT * FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME='t1';
EXPLAIN SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
WHERE CONSTRAINT_SCHEMA='test';
EXPLAIN SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
WHERE TABLE_NAME='t1' and TABLE_SCHEMA='test';
EXPLAIN SELECT * FROM INFORMATION_SCHEMA.TRIGGERS
WHERE EVENT_OBJECT_SCHEMA='test';
#
# Bug #43834 Assertion in Natural_join_column::db_name() on an I_S query
#
SELECT *
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
LEFT JOIN INFORMATION_SCHEMA.COLUMNS
USING (TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME)
WHERE COLUMNS.TABLE_SCHEMA = 'test'
AND COLUMNS.TABLE_NAME = 't1';
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@@ -1,5 +1,5 @@
# this test mostly test privilege control (what doesn't work
# in the embedded server by default). So disabled in embedded-server mode
# in the embedded server by default). So skip the test in embedded-server mode.
-- source include/not_embedded.inc
-- source include/testdb_only.inc
@@ -13,7 +13,7 @@ drop function if exists f2;
use INFORMATION_SCHEMA;
--replace_result Tables_in_INFORMATION_SCHEMA Tables_in_information_schema
show tables where Tables_in_information_schema not like "Innodb%";
show tables where Tables_in_INFORMATION_SCHEMA NOT LIKE 'Innodb%';
--replace_result 'Tables_in_INFORMATION_SCHEMA (T%)' 'Tables_in_information_schema (T%)'
show tables from INFORMATION_SCHEMA like 'T%';
create database `inf%`;
@@ -123,7 +123,7 @@ create view v1 as select f1 from t1;
grant insert on v1 to testdb_2@localhost;
create view v5 as select f1 from t1;
grant show view on v5 to testdb_2@localhost;
grant select, show view on v5 to testdb_2@localhost;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
create definer=`no_such_user`@`no_such_host` view v6 as select f1 from t1;
@@ -131,7 +131,7 @@ create definer=`no_such_user`@`no_such_host` view v6 as select f1 from t1;
connection default;
use testdb_1;
create view v6 as select f1 from t1;
grant show view on v6 to testdb_2@localhost;
grant select, show view on v6 to testdb_2@localhost;
create table t2 (f1 char(4));
create definer=`no_such_user`@`no_such_host` view v7 as select * from t2;
@@ -163,10 +163,10 @@ show fields from testdb_1.v7;
show create view testdb_1.v7;
revoke insert(f1) on v3 from testdb_2@localhost;
revoke show view on v5 from testdb_2@localhost;
revoke select,show view on v5 from testdb_2@localhost;
connection default;
use testdb_1;
revoke show view on v6 from testdb_2@localhost;
revoke select,show view on v6 from testdb_2@localhost;
connection testdb_2;
--error ER_TABLEACCESS_DENIED_ERROR

View File

@@ -479,9 +479,10 @@ INSERT INTO t2 SELECT NULL FROM t1;
DROP TABLE t1;
DROP TABLE t2;
#
# BUG#44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
# the index (PRIMARY)
# This test requires a restart of the server
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null);
@@ -495,6 +496,123 @@ SELECT * FROM t1;
-- error ER_AUTOINC_READ_FAILED,1467
INSERT INTO t1 VALUES(null);
ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
DROP TABLE t1;
# If the user has specified negative values for an AUTOINC column then
# InnoDB should ignore those values when setting the table's max value.
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SHOW VARIABLES LIKE "%auto_inc%";
# TINYINT
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-127, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-127, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
#
# SMALLINT
#
CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-32767, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-32757, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
#
# MEDIUMINT
#
CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-8388607, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-8388607, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
#
# INT
#
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-2147483647, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-2147483647, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
#
# BIGINT
#
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
INSERT INTO t1 VALUES (NULL, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
#
# End negative number check
##
# 47125: auto_increment start value is ignored if an index is created
# and engine=innodb
#
CREATE TABLE T1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
CREATE INDEX i1 on T1(c2);
SHOW CREATE TABLE T1;
INSERT INTO T1 (c2) values (0);
SELECT * FROM T1;
DROP TABLE T1;

View File

@@ -1 +1 @@
--binlog_cache_size=32768 --innodb_lock_wait_timeout=1
--binlog_cache_size=32768 --loose_innodb_lock_wait_timeout=1

View File

@@ -1 +1 @@
--innodb_lock_wait_timeout=2
--loose-innodb_lock_wait_timeout=2

View File

@@ -15,8 +15,6 @@
-- source include/have_innodb.inc
let $MYSQLD_DATADIR= `select @@datadir`;
# Save the original values of some variables in order to be able to
# estimate how much they have changed during the tests. Previously this
# test assumed that e.g. rows_deleted is 0 here and after deleting 23
@@ -1187,6 +1185,8 @@ drop table t2;
# Test error handling
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
--error ER_WRONG_FK_DEF
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
@@ -1317,7 +1317,6 @@ drop table t1;
# Test for testable InnoDB status variables. This test
# uses previous ones(pages_created, rows_deleted, ...).
# We get one of 511 or 512 randomly
--replace_result 511 512
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
@@ -1344,7 +1343,6 @@ show variables like "innodb_sync_spin_loops";
set global innodb_sync_spin_loops=@innodb_sync_spin_loops_orig;
# Test for innodb_thread_concurrency variable
SET @old_innodb_thread_concurrency= @@global.innodb_thread_concurrency;
show variables like "innodb_thread_concurrency";
set global innodb_thread_concurrency=1001;
show variables like "innodb_thread_concurrency";
@@ -1352,7 +1350,6 @@ set global innodb_thread_concurrency=0;
show variables like "innodb_thread_concurrency";
set global innodb_thread_concurrency=16;
show variables like "innodb_thread_concurrency";
SET @@global.innodb_thread_concurrency= @old_innodb_thread_concurrency;
# Test for innodb_concurrency_tickets variable
show variables like "innodb_concurrency_tickets";
@@ -1384,6 +1381,8 @@ source include/varchar.inc;
# Some errors/warnings on create
#
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
create table t1 (v varchar(65530), key(v));
drop table t1;
create table t1 (v varchar(65536));
@@ -1657,6 +1656,8 @@ disconnect b;
set foreign_key_checks=0;
create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
-- error 1005
create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
set foreign_key_checks=1;
@@ -1667,6 +1668,8 @@ drop table t2;
set foreign_key_checks=0;
create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
-- error 1005
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8;
set foreign_key_checks=1;
@@ -1696,7 +1699,8 @@ drop table t2,t1;
set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8;
--replace_result $MYSQLD_DATADIR ./
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
-- error 1025
rename table t3 to t1;
set foreign_key_checks=1;
@@ -2260,7 +2264,7 @@ disconnect j;
drop table t1, t2, t3, t5, t6, t8, t9;
# bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID"
--error 1005
--error ER_WRONG_COLUMN_NAME
CREATE TABLE t1 (DB_ROW_ID int) engine=innodb;
#
@@ -2335,7 +2339,8 @@ INSERT INTO t2 VALUES (1);
ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
# mysqltest first does replace_regex, then replace_result
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
--replace_result $MYSQLD_DATADIR ./
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
--error 1025
ALTER TABLE t2 MODIFY a INT NOT NULL;
DELETE FROM t1;

View File

@@ -22,7 +22,6 @@ CREATE TABLE bug34300 (
INSERT INTO bug34300 VALUES ('xxx', repeat('a', 8459264), 'zzz');
-- enable_query_log
-- enable_result_log
SELECT f4, f8 FROM bug34300;
@@ -32,8 +31,4 @@ ALTER TABLE bug34300 ADD COLUMN (f10 INT);
SELECT f4, f8 FROM bug34300;
DROP TABLE bug34300;
EVAL SET @@global.max_allowed_packet=$max_packet;
disconnect newconn;
connection default;
SET @@global.max_allowed_packet=default;

View File

@@ -9,6 +9,10 @@
-- source include/have_innodb.inc
--disable_query_log
call mtr.add_suppression("InnoDB: Error: table 'test/bug39438'");
--enable_query_log
SET storage_engine=InnoDB;
# we care only that the following SQL commands do not crash the server

View File

@@ -1 +1 @@
--innodb_commit_concurrency=1
--loose_innodb_commit_concurrency=1

View File

@@ -6,22 +6,12 @@
--source include/have_innodb.inc
# This create table operation should fail.
--error ER_CANT_CREATE_TABLE
--error ER_WRONG_COLUMN_NAME
create table bug44369 (DB_ROW_ID int) engine=innodb;
# This create should fail as well
--error ER_CANT_CREATE_TABLE
--error ER_WRONG_COLUMN_NAME
create table bug44369 (db_row_id int) engine=innodb;
# TODO: after Bug#47233 is fixed, 'show warning' should be replaced by 'show
# errors' again.
# show errors;
show warnings;
--error ER_CANT_CREATE_TABLE
--error ER_WRONG_COLUMN_NAME
create table bug44369 (db_TRX_Id int) engine=innodb;
# TODO: after Bug#47233 is fixed, 'show warning' should be replaced by 'show
# errors' again.
# show errors;
show warnings;

View File

@@ -7,24 +7,22 @@
# This 'create table' operation should fail because of
# using the reserve name as its index name.
--error ER_CANT_CREATE_TABLE
--error ER_WRONG_NAME_FOR_INDEX
create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
# Mixed upper/lower case of the reserved key words
--error ER_CANT_CREATE_TABLE
--error ER_WRONG_NAME_FOR_INDEX
create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
show errors;
show warnings;
create table bug46000(id int) engine=innodb;
# This 'create index' operation should fail.
--replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/
--error ER_CANT_CREATE_TABLE
--error ER_WRONG_NAME_FOR_INDEX
create index GEN_CLUST_INDEX on bug46000(id);
--replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/
show errors;
show warnings;
# This 'create index' operation should succeed, no
# temp table left from last failed create index

View File

@@ -0,0 +1,24 @@
# This is the test for bug 47777. GEOMETRY
# data is treated as BLOB data in innodb.
# Consequently, its key value generation/storing
# should follow the process for the BLOB
# datatype as well.
--source include/have_innodb.inc
create table bug47777(c2 linestring not null, primary key (c2(1))) engine=innodb;
insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'));
# Verify correct row get inserted.
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
# Update table bug47777 should be successful.
update bug47777 set c2=GeomFromText('POINT(1 1)');
# Verify the row get updated successfully. The original
# c2 value should be changed to GeomFromText('POINT(1 1)').
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)');
drop table bug47777;

View File

@@ -0,0 +1,264 @@
--source include/have_innodb.inc
--echo #
--echo # Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout
--echo # without error
--echo #
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b)) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES (1070109,99);
CREATE TABLE t2 (b int, a int, PRIMARY KEY (b)) ENGINE=InnoDB;
INSERT INTO t2 (b,a) VALUES (7,1070109);
SELECT * FROM t1;
BEGIN;
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
CONNECT (addconroot, localhost, root,,);
CONNECTION addconroot;
BEGIN;
--error ER_LOCK_WAIT_TIMEOUT
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
--error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 (a) VALUES ((SELECT a FROM t2 WHERE b=7));
--error ER_LOCK_WAIT_TIMEOUT
UPDATE t1 SET a='7000000' WHERE a=(SELECT a FROM t2 WHERE b=7);
--error ER_LOCK_WAIT_TIMEOUT
DELETE FROM t1 WHERE a=(SELECT a FROM t2 WHERE b=7);
SELECT * FROM t1;
CONNECTION default;
DISCONNECT addconroot;
DROP TABLE t2, t1;
--echo # End of 5.0 tests
--echo #
--echo # Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT
--echo # FOR UPDATE
--echo #
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (a int primary key auto_increment,
b int, index(b)) engine=innodb;
insert into t1 (b) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
set autocommit=0;
begin;
select * from t1 where b=5 for update;
connect (con1, localhost, root,,);
connection con1;
--error ER_LOCK_WAIT_TIMEOUT
insert ignore into t1 (b) select a as b from t1;
connection default;
--echo # Cleanup
--echo #
disconnect con1;
commit;
set autocommit=default;
drop table t1;
--echo #
--echo # Bug #37183 insert ignore into .. select ... hangs
--echo # after deadlock was encountered
--echo #
connect (con1,localhost,root,,);
create table t1(id int primary key,v int)engine=innodb;
insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7);
create table t2 like t1;
--connection con1
begin;
update t1 set v=id*2 where id=1;
--connection default
begin;
update t1 set v=id*2 where id=2;
--connection con1
--error 1205
update t1 set v=id*2 where id=2;
--connection default
--error 1205
insert ignore into t2 select * from t1 where id=1;
rollback;
--connection con1
rollback;
--connection default
disconnect con1;
drop table t1, t2;
--echo #
--echo # Bug#41756 Strange error messages about locks from InnoDB
--echo #
--disable_warnings
drop table if exists t1;
--enable_warnings
--echo # In the default transaction isolation mode, and/or with
--echo # innodb_locks_unsafe_for_binlog=OFF, handler::unlock_row()
--echo # in InnoDB does nothing.
--echo # Thus in order to reproduce the condition that led to the
--echo # warning, one needs to relax isolation by either
--echo # setting a weaker tx_isolation value, or by turning on
--echo # the unsafe replication switch.
--echo # For testing purposes, choose to tweak the isolation level,
--echo # since it's settable at runtime, unlike
--echo # innodb_locks_unsafe_for_binlog, which is
--echo # only a command-line switch.
--echo #
set @@session.tx_isolation="read-committed";
--echo # Prepare data. We need a table with a unique index,
--echo # for join_read_key to be used. The other column
--echo # allows to control what passes WHERE clause filter.
create table t1 (a int primary key, b int) engine=innodb;
--echo # Let's make sure t1 has sufficient amount of rows
--echo # to exclude JT_ALL access method when reading it,
--echo # i.e. make sure that JT_EQ_REF(a) is always preferred.
insert into t1 values (1,1), (2,null), (3,1), (4,1),
(5,1), (6,1), (7,1), (8,1), (9,1), (10,1),
(11,1), (12,1), (13,1), (14,1), (15,1),
(16,1), (17,1), (18,1), (19,1), (20,1);
--echo #
--echo # Demonstrate that for the SELECT statement
--echo # used later in the test JT_EQ_REF access method is used.
--echo #
--vertical_results
explain
select 1 from t1 natural join (select 2 as a, 1 as b union all
select 2 as a, 2 as b) as t2 for update;
--horizontal_results
--echo #
--echo # Demonstrate that the reported SELECT statement
--echo # no longer produces warnings.
--echo #
select 1 from t1 natural join (select 2 as a, 1 as b union all
select 2 as a, 2 as b) as t2 for update;
commit;
--echo #
--echo # Demonstrate that due to lack of inter-sweep "reset" function,
--echo # we keep some non-matching records locked, even though we know
--echo # we could unlock them.
--echo # To do that, show that if there is only one distinct value
--echo # for a in t2 (a=2), we will keep record (2,null) in t1 locked.
--echo # But if we add another value for "a" to t2, say 6,
--echo # join_read_key cache will be pruned at least once,
--echo # and thus record (2, null) in t1 will get unlocked.
--echo #
begin;
select 1 from t1 natural join (select 2 as a, 1 as b union all
select 2 as a, 2 as b) as t2 for update;
connect (con1,localhost,root,,);
--echo #
--echo # Switching to connection con1
connection con1;
--echo # We should be able to delete all records from t1 except (2, null),
--echo # since they were not locked.
begin;
--echo # Delete in series of 3 records so that full scan
--echo # is not used and we're not blocked on record (2,null)
delete from t1 where a in (1,3,4);
delete from t1 where a in (5,6,7);
delete from t1 where a in (8,9,10);
delete from t1 where a in (11,12,13);
delete from t1 where a in (14,15,16);
delete from t1 where a in (17,18);
delete from t1 where a in (19,20);
--echo #
--echo # Record (2, null) is locked. This is actually unnecessary,
--echo # because the previous select returned no rows.
--echo # Just demonstrate the effect.
--echo #
--error ER_LOCK_WAIT_TIMEOUT
delete from t1;
rollback;
--echo #
--echo # Switching to connection default
connection default;
--echo #
--echo # Show that the original contents of t1 is intact:
select * from t1;
commit;
--echo #
--echo # Have a one more record in t2 to show that
--echo # if join_read_key cache is purned, the current
--echo # row under the cursor is unlocked (provided, this row didn't
--echo # match the partial WHERE clause, of course).
--echo # Sic: the result of this test dependent on the order of retrieval
--echo # of records --echo # from the derived table, if !
--echo # We use DELETE to disable the JOIN CACHE. This DELETE modifies no
--echo # records. It also should leave no InnoDB row locks.
--echo #
begin;
delete t1.* from t1 natural join (select 2 as a, 2 as b union all
select 0 as a, 0 as b) as t2;
--echo # Demonstrate that nothing was deleted form t1
select * from t1;
--echo #
--echo # Switching to connection con1
connection con1;
begin;
--echo # Since there is another distinct record in the derived table
--echo # the previous matching record in t1 -- (2,null) -- was unlocked.
delete from t1;
--echo # We will need the contents of the table again.
rollback;
select * from t1;
commit;
--echo #
--echo # Switching to connection default
connection default;
rollback;
begin;
--echo #
--echo # Before this patch, we could wrongly unlock a record
--echo # that was cached and later used in a join. Demonstrate that
--echo # this is no longer the case.
--echo # Sic: this test is also order-dependent (i.e. the
--echo # the bug would show up only if the first record in the union
--echo # is retreived and processed first.
--echo #
--echo # Verify that JT_EQ_REF is used.
--vertical_results
explain
select 1 from t1 natural join (select 3 as a, 2 as b union all
select 3 as a, 1 as b) as t2 for update;
--horizontal_results
--echo # Lock the record.
select 1 from t1 natural join (select 3 as a, 2 as b union all
select 3 as a, 1 as b) as t2 for update;
--echo # Switching to connection con1
connection con1;
--echo #
--echo # We should not be able to delete record (3,1) from t1,
--echo # (previously it was possible).
--echo #
--error ER_LOCK_WAIT_TIMEOUT
delete from t1 where a=3;
--echo # Switching to connection default
connection default;
commit;
disconnect con1;
set @@session.tx_isolation=default;
drop table t1;
--echo #
--echo # End of 5.1 tests
--echo #

View File

@@ -461,4 +461,97 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX(PRIMARY) WHERE b=1 AND c=1 ORDER BY a;
DROP TABLE t1;
--echo #
--echo # Bug #47963: Wrong results when index is used
--echo #
CREATE TABLE t1(
a VARCHAR(5) NOT NULL,
b VARCHAR(5) NOT NULL,
c DATETIME NOT NULL,
KEY (c)
) ENGINE=InnoDB;
INSERT INTO t1 VALUES('TEST', 'TEST', '2009-10-09 00:00:00');
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00';
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00.0';
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.0' AND c <= '2009-10-09 00:00:00';
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00' AND c <= '2009-10-09 00:00:00.0';
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.000' AND c <= '2009-10-09 00:00:00.000';
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.00' AND c <= '2009-10-09 00:00:00.001';
SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
EXPLAIN SELECT * FROM t1 WHERE a = 'TEST' AND
c >= '2009-10-09 00:00:00.001' AND c <= '2009-10-09 00:00:00.00';
DROP TABLE t1;
--echo #
--echo # Bug #46175: NULL read_view and consistent read assertion
--echo #
CREATE TABLE t1(a CHAR(13),KEY(a)) ENGINE=innodb;
CREATE TABLE t2(b DATETIME,KEY(b)) ENGINE=innodb;
INSERT INTO t1 VALUES (),();
INSERT INTO t2 VALUES (),();
CREATE OR REPLACE VIEW v1 AS SELECT 1 FROM t2
WHERE b =(SELECT a FROM t1 LIMIT 1);
--disable_query_log
--disable_result_log
CONNECT (con1, localhost, root,,);
--enable_query_log
--enable_result_log
CONNECTION default;
DELIMITER |;
CREATE PROCEDURE p1(num INT)
BEGIN
DECLARE i INT DEFAULT 0;
REPEAT
SHOW CREATE VIEW v1;
SET i:=i+1;
UNTIL i>num END REPEAT;
END|
DELIMITER ;|
--echo # Should not crash
--disable_query_log
--disable_result_log
--send CALL p1(1000)
CONNECTION con1;
--echo # Should not crash
CALL p1(1000);
CONNECTION default;
--reap
--enable_query_log
--enable_result_log
DISCONNECT con1;
DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1,t2;
--echo End of 5.1 tests
--echo #
--echo # Test for bug #39932 "create table fails if column for FK is in different
--echo # case than in corr index".
--echo #
--disable_warnings
drop tables if exists t1, t2;
--enable_warnings
create table t1 (pk int primary key) engine=InnoDB;
--echo # Even although the below statement uses uppercased field names in
--echo # foreign key definition it still should be able to find explicitly
--echo # created supporting index. So it should succeed and should not
--echo # create any additional supporting indexes.
create table t2 (fk int, key x (fk),
constraint x foreign key (FK) references t1 (PK)) engine=InnoDB;
show create table t2;
drop table t2, t1;

View File

@@ -235,8 +235,10 @@ insert into t1 values (1,11), (2,22);
insert into t2 values (1,12), (2,24);
--error 1393
insert into v1 (f1) values (3) on duplicate key update f3= f3 + 10;
--error 1393
insert into v1 (f1) values (3) on duplicate key update f1= f3 + 10;
select * from t1;
--error 1393
insert into v1 (f1) values (3) on duplicate key update f1= f3 + 10;
select * from t1;
drop view v1;
@@ -499,3 +501,33 @@ DROP TABLE t1, t2;
--echo End of 5.0 tests.
--echo #
--echo # Bug#34898 "mysql_info() reports 0 warnings while
--echo # mysql_warning_count() reports 1"
--echo # Check that the number of warnings reported by
--echo # mysql_info() is correct.
--echo #
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (data varchar(4) not null);
set sql_mode='error_for_division_by_zero';
--echo #
--echo # Demonstrate that the number of warnings matches
--echo # the information in mysql_info().
--echo #
--enable_info
insert t1 (data) values ('letter'), (1/0);
update t1 set data='envelope' where 1/0 or 1;
insert t1 (data) values (default), (1/0), ('dead beef');
--disable_info
set sql_mode=default;
drop table t1;
--echo #
--echo # End of 5.4 tests
--echo #

View File

@@ -185,5 +185,6 @@ select * from t1;
connection default;
disconnect update;
disconnect select;
unlock tables;
drop table t1;
set low_priority_updates=default;

View File

@@ -0,0 +1 @@
--skip-name-resolve --bind-address=0.0.0.0

View File

@@ -0,0 +1,65 @@
# Copyright (C) 2009 SUN Microsystems
# All rights reserved. Use is subject to license terms.
# Author: Horst Hunger
# Nov. 19, 2009
# Test of ipv4 (127.0.0.1) in ipv6 format
# Options: --skip-name-resolve, --bind-address=0.0.0.0 (see corresponding opt file).
#
# Can't be tested with windows due to mixed format like 0::0000:FFFF:127.0.0.1
--source include/not_windows.inc
# Can't be tested with embedded server
--source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
echo =============Test of '127.0.0.1' (IPv4) ===========================;
let $IPv6= 127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0:0:0:0:0:FFFF:127.0.0.1' ===================;
let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0000:0000:0000:0000:0000:FFFF:127.0.0.1' ====;
let $IPv6= 0000:0000:0000:0000:0000:FFFF:127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0:0000:0000:0:0000:FFFF:127.0.0.1' ====;
let $IPv6= 0:0000:0000:0:0000:FFFF:127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0::0000:FFFF:127.0.0.1' ====;
let $IPv6= 0::0000:FFFF:127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0:0:0:0:0:FFFF:127.0.0.1/96' ================;
let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1/96;
#--source include/ipv6_clients.inc
#--source include/ipv6.inc
echo =============Test of '::FFFF:127.0.0.1' ===========================;
let $IPv6= ::FFFF:127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '::FFFF:127.0.0.1/96' ========================;
let $IPv6= ::FFFF:127.0.0.1/96;
#--source include/ipv6_clients.inc
#--source include/ipv6.inc
echo =============Test of '::1' ========================;
let $IPv6= ::1;
--echo connect (con1, $IPv6, root, , test, MASTER_MYPORT,);
--disable_query_log
--error 2003,2006
connect (con1, $IPv6, root, , test, $MASTER_MYPORT,);
--enable_query_log
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@@ -0,0 +1 @@
--skip-name-resolve --bind-address=0.0.0.0

View File

@@ -0,0 +1,31 @@
# Copyright (C) 2009 SUN Microsystems
# All rights reserved. Use is subject to license terms.
# Author: Horst Hunger
# Nov. 19, 2009
# Test of ipv4 (127.0.0.1) in ipv6 format
# Options: --skip-name-resolve, --bind-address=0.0.0.0 (see corresponding opt file).
#
# For windows due to missing the mixed format like 0::0000:FFFF:127.0.0.1
--source include/windows.inc
# Can't be tested with embedded server
--source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
echo =============Test of '127.0.0.1' (IPv4) ===========================;
let $IPv6= 127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '::1' ========================;
let $IPv6= ::1;
--echo connect (con1, $IPv6, root, , test, MASTER_MYPORT);
--disable_query_log
--error 2003,2006
connect (con1, $IPv6, root, , test, $MASTER_MYPORT);
--enable_query_log
connection default;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@@ -0,0 +1 @@
--skip-name-resolve --bind-address=::

79
mysql-test/t/ipv6.test Normal file
View File

@@ -0,0 +1,79 @@
# Copyright (C) 2009 SUN Microsystems
# All rights reserved. Use is subject to license terms.
# Author: Horst Hunger
# Nov. 19, 2009
# Test of ipv6 format
# Options: --skip-name-resolve, --bind-address=:: (see corresponding opt file).
#
--source include/check_ipv6.inc
# Can't be tested with windows due to the mixed format like 0:0:0:0:0:FFFF:127.0.0.1
--source include/not_windows.inc
# Can't be tested with embedded server
--source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
echo =============Test of '::1' ========================================;
let $IPv6= ::1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '::1/128' ====================================;
let $IPv6= ::1/128;
#--source include/ipv6_clients.inc
#--source include/ipv6.inc
echo =============Test of '0000:0000:0000:0000:0000:0000:0000:0001' ====;
let $IPv6= 0000:0000:0000:0000:0000:0000:0000:0001;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0:0:0:0:0:0:0:1' ============================;
let $IPv6= 0:0:0:0:0:0:0:1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '127.0.0.1' (IPv4) ===========================;
let $IPv6= 127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0:0:0:0:0:FFFF:127.0.0.1' ===================;
let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0000:0000:0000:0000:0000:FFFF:127.0.0.1' ====;
let $IPv6= 0000:0000:0000:0000:0000:FFFF:127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0:0000:0000:0:0000:FFFF:127.0.0.1' ====;
let $IPv6= 0:0000:0000:0:0000:FFFF:127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0::0000:FFFF:127.0.0.1' ====;
let $IPv6= 0::0000:FFFF:127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0:0:0:0:0:FFFF:127.0.0.1/96' ================;
let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1/96;
#--source include/ipv6_clients.inc
#--source include/ipv6.inc
echo =============Test of '::FFFF:127.0.0.1' ===========================;
let $IPv6= ::FFFF:127.0.0.1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '::FFFF:127.0.0.1/96' ========================;
let $IPv6= ::FFFF:127.0.0.1/96;
#--source include/ipv6_clients.inc
#--source include/ipv6.inc
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@@ -0,0 +1 @@
--skip-name-resolve --bind-address=::

View File

@@ -0,0 +1,39 @@
# Copyright (C) 2009 SUN Microsystems
# All rights reserved. Use is subject to license terms.
# Author: Horst Hunger
# Nov. 19, 2009
# Test of ipv6 format
# Options: --skip-name-resolve, --bind-address=:: (see corresponding opt file).
#
--source include/check_ipv6.inc
# For windows due to missing the mixed format like 0::0000:FFFF:127.0.0.1
--source include/windows.inc
# Can't be tested with embedded server
--source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
echo =============Test of '::1' ========================================;
let $IPv6= ::1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '::1/128' ====================================;
let $IPv6= ::1/128;
#--source include/ipv6_clients.inc
#--source include/ipv6.inc
echo =============Test of '0000:0000:0000:0000:0000:0000:0000:0001' ====;
let $IPv6= 0000:0000:0000:0000:0000:0000:0000:0001;
--source include/ipv6_clients.inc
--source include/ipv6.inc
echo =============Test of '0:0:0:0:0:0:0:1' ============================;
let $IPv6= 0:0:0:0:0:0:0:1;
--source include/ipv6_clients.inc
--source include/ipv6.inc
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@@ -730,6 +730,60 @@ SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a;
DROP TABLE IF EXISTS t1,t2;
--echo #
--echo # Bug #42116: Mysql crash on specific query
--echo #
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
CREATE TABLE t3 (a INT, INDEX (a));
CREATE TABLE t4 (a INT);
CREATE TABLE t5 (a INT);
CREATE TABLE t6 (a INT);
INSERT INTO t1 VALUES (1), (1), (1);
INSERT INTO t2 VALUES
(2), (2), (2), (2), (2), (2), (2), (2), (2), (2);
INSERT INTO t3 VALUES
(3), (3), (3), (3), (3), (3), (3), (3), (3), (3);
EXPLAIN
SELECT *
FROM
t1 JOIN t2 ON t1.a = t2.a
LEFT JOIN
(
(
t3 LEFT JOIN t4 ON t3.a = t4.a
)
LEFT JOIN
(
t5 LEFT JOIN t6 ON t5.a = t6.a
)
ON t4.a = t5.a
)
ON t1.a = t3.a;
SELECT *
FROM
t1 JOIN t2 ON t1.a = t2.a
LEFT JOIN
(
(
t3 LEFT JOIN t4 ON t3.a = t4.a
)
LEFT JOIN
(
t5 LEFT JOIN t6 ON t5.a = t6.a
)
ON t4.a = t5.a
)
ON t1.a = t3.a;
DROP TABLE t1,t2,t3,t4,t5,t6;
--echo End of 5.0 tests.

View File

@@ -0,0 +1,45 @@
--disable_warnings
drop table if exists t0,t1,t2,t3;
--enable_warnings
--echo #
--echo # BUG#38049 incorrect rows estimations with references from preceding table
--echo #
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (a varchar(32));
insert into t1 values ('owner'),('requester'),('admincc'),('cc');
CREATE TABLE t2 (
id int(11) NOT NULL,
type varchar(32) default NULL,
PRIMARY KEY (id)
);
insert into t2 values (1,'owner'), (2,'admincc');
CREATE TABLE t3 (
id int(11) NOT NULL,
domain varchar(32) default NULL,
type varchar(32) default NULL,
PRIMARY KEY (id)
);
set @domain='system';
set @pk=0;
INSERT INTO t3 select @pk:=@pk+1, 'system', t1.a from t1;
INSERT INTO t3 select @pk:=@pk+1, 'queue', t1.a from t1, t0 where t0.a<3;
INSERT INTO t3 select @pk:=@pk+1, 'ticket', t1.a from t1, t0 A, t0 B, t0 C;
CREATE INDEX groups_d ON t3(domain);
CREATE INDEX groups_t ON t3(type);
CREATE INDEX groups_td ON t3(type, domain);
CREATE INDEX groups_dt ON t3(domain, type);
--echo For table g this must use ref(groups_dt) and #rows should be around 15 and not 335:
explain
SELECT STRAIGHT_JOIN g.id FROM t2 a, t3 g USE INDEX(groups_dt)
WHERE g.domain = 'queue' AND g.type = a.type;
drop table t0,t1,t2,t3;

View File

@@ -97,7 +97,7 @@ select ((@id := kill_id) - kill_id) from t3;
kill @id;
connection conn1;
-- error 1053,2013
-- error 1317,2013
reap;
connection default;

View File

@@ -70,17 +70,18 @@ connection addconroot;
create table t2(fl text);
--let $PSEUDO_THREAD_ID=`select @@pseudo_thread_id `
--send LOAD XML LOCAL INFILE "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO TABLE t2 ROWS IDENTIFIED BY '<person>';
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--send_eval LOAD XML LOCAL INFILE "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO TABLE t2 ROWS IDENTIFIED BY '<person>';
sleep 3;
connection default;
--replace_column 1 # 3 localhost 6 #
show processlist;
sleep 1;
--disable_query_log
--eval kill $PSEUDO_THREAD_ID
sleep 2;
--enable_query_log
disconnect addconroot;

View File

@@ -31,4 +31,26 @@ SELECT a, date_format(a,'%b') as abmon, monthname(a) as mon FROM t1 ORDER BY a;
SELECT format(123456.789, 3, 'el_GR');
DROP TABLE t1;
--echo #
--echo # Bug#46633 Obsolete Serbian locale name
--echo #
SET lc_messages=sr_YU;
SHOW VARIABLES LIKE 'lc_messages';
SET lc_messages=sr_RS;
SHOW VARIABLES LIKE 'lc_messages';
SET lc_time_names=sr_RS;
SELECT format(123456.789, 3, 'sr_RS');
--echo #
--echo # Bug#43207 wrong LC_TIME names for romanian locale
--echo #
SET NAMES utf8;
SET lc_time_names=ro_RO;
SELECT DATE_FORMAT('2001-01-01', '%w %a %W');
SELECT DATE_FORMAT('2001-01-02', '%w %a %W');
SELECT DATE_FORMAT('2001-01-03', '%w %a %W');
SELECT DATE_FORMAT('2001-01-04', '%w %a %W');
SELECT DATE_FORMAT('2001-01-05', '%w %a %W');
SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
SELECT DATE_FORMAT('2001-01-07', '%w %a %W');
--echo End of 5.4 tests

View File

@@ -58,6 +58,9 @@ insert into t1 select index1,nr from t1;
unlock tables;
lock tables t1 write, t1 as t1_alias read;
insert into t1 select index1,nr from t1 as t1_alias;
--error ER_TABLE_NOT_LOCKED
drop table t1,t2;
unlock tables;
drop table t1,t2;
#
@@ -90,7 +93,10 @@ delete t1 from t1,t2 where t1.a=t2.a;
delete from t2 using t1,t2 where t1.a=t2.a;
--error 1099
delete t2 from t1,t2 where t1.a=t2.a;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
drop table t1,t2;
unlock tables;
drop table t2,t1;
--echo End of 4.1 tests.

View File

@@ -1,5 +1,3 @@
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
@@ -78,6 +76,7 @@ update t1,t2 set c=a where b=d;
connection reader;
select c from t2;
connection locker;
unlock tables;
drop table t1;
drop table t2;
@@ -637,6 +636,41 @@ select @tlwa < @tlwb;
--echo End of 5.1 tests
#
# Test that DROP TABLES does not wait for a impending FLUSH TABLES
# WITH READ LOCK
#
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (i int);
connect (flush,localhost,root,,test,,);
connection default;
--echo connection: default
lock tables t1 write;
connection flush;
--echo connection: flush
--send flush tables with read lock;
connection default;
--echo connection: default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Flushing tables";
--source include/wait_condition.inc
flush tables;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Flushing tables";
--source include/wait_condition.inc
drop table t1;
let $wait_condition=
select count(*) = 0 from information_schema.processlist
where state = "Flushing tables";
--source include/wait_condition.inc
connection flush;
--reap
connection default;
disconnect flush;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

118
mysql-test/t/lock_sync.test Normal file
View File

@@ -0,0 +1,118 @@
#
# Locking related tests which use DEBUG_SYNC facility.
#
--source include/have_debug_sync.inc
# We need InnoDB to be able use TL_WRITE_ALLOW_WRITE type of locks in our tests.
--source include/have_innodb.inc
# Until bug#41971 'Thread state on embedded server is always "Writing to net"'
# is fixed this test can't be run on embedded version of server.
--source include/not_embedded.inc
# Save the initial number of concurrent sessions.
--source include/count_sessions.inc
--echo #
--echo # Test for bug #45143 "All connections hang on concurrent ALTER TABLE".
--echo #
--echo # Concurrent execution of statements which required weak write lock
--echo # (TL_WRITE_ALLOW_WRITE) on several instances of the same table and
--echo # statements which tried to acquire stronger write lock (TL_WRITE,
--echo # TL_WRITE_ALLOW_READ) on this table might have led to deadlock.
--disable_warnings
drop table if exists t1;
--enable_warnings
--echo # Create auxiliary connections used through the test.
connect (con_bug45143_1,localhost,root,,test,,);
connect (con_bug45143_3,localhost,root,,test,,);
connect (con_bug45143_2,localhost,root,,test,,);
connection default;
--echo # Reset DEBUG_SYNC facility before using it.
set debug_sync= 'RESET';
--echo # Turn off logging so calls to locking subsystem performed
--echo # for general_log table won't interfere with our test.
set @old_general_log = @@global.general_log;
set @@global.general_log= OFF;
create table t1 (i int) engine=InnoDB;
insert into t1 values (1);
--echo # Prepare user lock which will be used for resuming execution of
--echo # the first statement after it acquires TL_WRITE_ALLOW_WRITE lock.
select get_lock("lock_bug45143_wait", 0);
--echo # Switch to connection 'con_bug45143_1'.
connection con_bug45143_1;
--echo # Sending:
--send insert into t1 values (get_lock("lock_bug45143_wait", 100));
--echo # Switch to connection 'con_bug45143_2'.
connection con_bug45143_2;
--echo # Wait until the above INSERT takes TL_WRITE_ALLOW_WRITE lock on 't1'
--echo # and then gets blocked on user lock 'lock_bug45143_wait'.
let $wait_condition= select count(*)= 1 from information_schema.processlist
where state= 'User lock' and
info='insert into t1 values (get_lock("lock_bug45143_wait", 100))';
--source include/wait_condition.inc
--echo # Ensure that upcoming SELECT waits after acquiring TL_WRITE_ALLOW_WRITE
--echo # lock for the first instance of 't1'.
set debug_sync='thr_multi_lock_after_thr_lock SIGNAL parked WAIT_FOR go';
--echo # Sending:
--send select count(*) > 0 from t1 as a, t1 as b for update;
--echo # Switch to connection 'con_bug45143_3'.
connection con_bug45143_3;
--echo # Wait until the above SELECT ... FOR UPDATE is blocked after
--echo # acquiring lock for the the first instance of 't1'.
set debug_sync= 'now WAIT_FOR parked';
--echo # Send LOCK TABLE statement which will try to get TL_WRITE lock on 't1':
--send lock table t1 write;
--echo # Switch to connection 'default'.
connection default;
--echo # Wait until this LOCK TABLES statement starts waiting for table lock.
let $wait_condition= select count(*)= 1 from information_schema.processlist
where state= 'Locked' and
info='lock table t1 write';
--source include/wait_condition.inc
--echo # Allow SELECT ... FOR UPDATE to resume.
--echo # Since it already has TL_WRITE_ALLOW_WRITE lock on the first instance
--echo # of 't1' it should be able to get lock on the second instance without
--echo # waiting, even although there is another thread which has such lock
--echo # on this table and also there is a thread waiting for a TL_WRITE on it.
set debug_sync= 'now SIGNAL go';
--echo # Switch to connection 'con_bug45143_2'.
connection con_bug45143_2;
--echo # Reap SELECT ... FOR UPDATE
--reap
--echo # Switch to connection 'default'.
connection default;
--echo # Resume execution of the INSERT statement.
select release_lock("lock_bug45143_wait");
--echo # Switch to connection 'con_bug45143_1'.
connection con_bug45143_1;
--echo # Reap INSERT statement.
--reap
--echo # Switch to connection 'con_bug45143_3'.
connection con_bug45143_3;
--echo # Reap LOCK TABLES statement.
--reap
unlock tables;
--echo # Switch to connection 'default'.
connection default;
--echo # Do clean-up.
disconnect con_bug45143_1;
disconnect con_bug45143_2;
disconnect con_bug45143_3;
set debug_sync= 'RESET';
set @@global.general_log= @old_general_log;
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

View File

@@ -1,16 +1,5 @@
### t/log_state.test ###
#
# This test suffers from server
# Bug#38124 "general_log_file" variable silently unset when using expression
# In short:
# SET GLOBAL general_log_file = @<whatever>
# SET GLOBAL slow_query_log = @<whatever>
# cause that the value of these server system variables is set to default
# instead of the assigned values. There comes no error message or warning.
# If this bug is fixed please
# 1. try this test with "let $fixed_bug38124 = 0;"
# 2. remove all workarounds if 1. was successful.
let $fixed_bug38124 = 0;
--source include/not_embedded.inc
--source include/have_csv.inc
@@ -166,16 +155,6 @@ SET @@global.general_log = @old_general_log;
SET @@global.general_log_file = @old_general_log_file;
SET @@global.slow_query_log = @old_slow_query_log;
SET @@global.slow_query_log_file = @old_slow_query_log_file;
if(!$fixed_bug38124)
{
--disable_query_log
let $my_var = `SELECT @old_general_log_file`;
eval SET @@global.general_log_file = '$my_var';
let $my_var = `SELECT @old_slow_query_log_file`;
eval SET @@global.slow_query_log_file = '$my_var';
--enable_query_log
}
###########################################################################
@@ -278,15 +257,6 @@ SET GLOBAL slow_query_log_file= NULL;
# Reset to initial values in case a setting above was successful.
SET GLOBAL general_log_file= @old_general_log_file;
SET GLOBAL slow_query_log_file= @old_slow_query_log_file;
if(!$fixed_bug38124)
{
--disable_query_log
let $my_var = `SELECT @old_general_log_file`;
eval SET @@global.general_log_file = '$my_var';
let $my_var = `SELECT @old_slow_query_log_file`;
eval SET @@global.slow_query_log_file = '$my_var';
--enable_query_log
}
###########################################################################
@@ -307,15 +277,6 @@ SHOW VARIABLES LIKE '%log_file';
--echo
SET GLOBAL general_log_file = @old_general_log_file;
SET GLOBAL slow_query_log_file = @old_slow_query_log_file;
if(!$fixed_bug38124)
{
--disable_query_log
let $my_var = `SELECT @old_general_log_file`;
eval SET @@global.general_log_file = '$my_var';
let $my_var = `SELECT @old_slow_query_log_file`;
eval SET @@global.slow_query_log_file = '$my_var';
--enable_query_log
}
--echo
--echo # -- End of Bug#32748.
@@ -351,19 +312,43 @@ SET @@global.general_log = @old_general_log;
SET @@global.general_log_file = @old_general_log_file;
SET @@global.slow_query_log = @old_slow_query_log;
SET @@global.slow_query_log_file = @old_slow_query_log_file;
if(!$fixed_bug38124)
{
--disable_query_log
let $my_var = `SELECT @old_general_log_file`;
eval SET @@global.general_log_file = '$my_var';
let $my_var = `SELECT @old_slow_query_log_file`;
eval SET @@global.slow_query_log_file = '$my_var';
--enable_query_log
}
--echo End of 5.1 tests
###########################################################################
--echo
--echo # --
--echo # -- Bug#38124: "general_log_file" variable silently unset when
--echo # -- using expression
--echo # --
# Store away the special DEFAULT value so we
# can compare it later, then try to set the
# general_log_file using different functions
# and expressions.
SET GLOBAL general_log_file = DEFAULT;
SELECT @@general_log_file INTO @my_glf;
SET GLOBAL general_log_file = 'BUG38124.LOG';
SELECT @@general_log_file;
SET GLOBAL general_log_file = concat('BUG38124-2.LOG');
SELECT @@general_log_file;
SET GLOBAL general_log_file = substr('BUG38124-2.LOG',3,6);
SELECT @@general_log_file;
SET GLOBAL general_log_file = DEFAULT;
SELECT @@general_log_file = @my_glf;
## Reset to initial values
SET GLOBAL general_log_file = @old_general_log_file;
--enable_ps_protocol
#
@@ -380,17 +365,7 @@ SET global general_log = @old_general_log;
SET global general_log_file = @old_general_log_file;
SET global slow_query_log = @old_slow_query_log;
SET global slow_query_log_file = @old_slow_query_log_file;
if(!$fixed_bug38124)
{
--disable_query_log
let $my_var = `SELECT @old_general_log_file`;
eval SET @@global.general_log_file = '$my_var';
let $my_var = `SELECT @old_slow_query_log_file`;
eval SET @@global.slow_query_log_file = '$my_var';
--enable_query_log
}
# Remove the log files that was created in the "default location"
# Remove the log file that was created in the "default location"
# i.e var/run
--remove_file $MYSQLTEST_VARDIR/run/mysqld.log
--remove_file $MYSQLTEST_VARDIR/tmp/log.master

View File

@@ -0,0 +1 @@
--pid-file=$MYSQLTEST_VARDIR/run/mysqld.1.pid --log=

View File

@@ -0,0 +1,18 @@
### t/log_state_bug33693.test
#
# Regression test for bug #33693
# "general log name and location depend on PID
# file, not on predefined values"
#
# The server is started with a hard-coded
# PID file in the $MYSQLTEST_VARDIR/run
# directory, and an unspecified general log
# file name.
#
# The correct result should show the log file to
# rest in the database directory. Unfixed, the
# log file will be in the same directory as the
# PID.
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT INSTR(@@general_log_file, '$MYSQLTEST_VARDIR/run');

View File

@@ -258,14 +258,21 @@ set global slow_query_log='OFF';
# check that alter table doesn't work for other engines
set @save_storage_engine= @@session.storage_engine;
set storage_engine= MEMORY;
# After fixing bug#35765 the error behaivor changed:
# If compiled in/enabled ER_UNSUPORTED_LOG_ENGINE
# If not (i.e. not existant) it will show a warning
# and use the current one.
alter table mysql.slow_log engine=NonExistentEngine;
--error ER_UNSUPORTED_LOG_ENGINE
alter table mysql.slow_log engine=ndb;
--error ER_UNSUPORTED_LOG_ENGINE
alter table mysql.slow_log engine=innodb;
--error ER_UNSUPORTED_LOG_ENGINE
alter table mysql.slow_log engine=archive;
--error ER_UNSUPORTED_LOG_ENGINE
alter table mysql.slow_log engine=blackhole;
alter table mysql.slow_log engine=memory;
#--error ER_UNSUPORTED_LOG_ENGINE
#alter table mysql.slow_log engine=ndb;
#--error ER_UNSUPORTED_LOG_ENGINE
#alter table mysql.slow_log engine=innodb;
#--error ER_UNSUPORTED_LOG_ENGINE
#alter table mysql.slow_log engine=archive;
#--error ER_UNSUPORTED_LOG_ENGINE
#alter table mysql.slow_log engine=blackhole;
set storage_engine= @save_storage_engine;
drop table mysql.slow_log;

View File

@@ -29,3 +29,65 @@ disconnect master;
connection default;
# End of 4.1 tests
#
# Bug#41049 does syntax "grant" case insensitive?
#
CREATE DATABASE d1;
USE d1;
CREATE TABLE T1(f1 INT);
CREATE TABLE t1(f1 INT);
GRANT SELECT ON T1 to user_1@localhost;
connect (con1,localhost,user_1,,d1);
--error ER_TABLEACCESS_DENIED_ERROR
select * from t1;
select * from T1;
connection default;
GRANT SELECT ON t1 to user_1@localhost;
connection con1;
select * from information_schema.table_privileges;
connection default;
disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
DROP USER user_1@localhost;
DROP DATABASE d1;
USE test;
CREATE DATABASE db1;
USE db1;
CREATE PROCEDURE p1() BEGIN END;
CREATE FUNCTION f1(i INT) RETURNS INT RETURN i+1;
GRANT USAGE ON db1.* to user_1@localhost;
GRANT EXECUTE ON PROCEDURE db1.P1 to user_1@localhost;
GRANT EXECUTE ON FUNCTION db1.f1 to user_1@localhost;
GRANT UPDATE ON db1.* to USER_1@localhost;
connect (con1,localhost,user_1,,db1);
call p1();
call P1();
select f1(1);
connect (con2,localhost,USER_1,,db1);
--error ER_PROCACCESS_DENIED_ERROR
call p1();
--error ER_PROCACCESS_DENIED_ERROR
call P1();
--error ER_PROCACCESS_DENIED_ERROR
select f1(1);
connection default;
disconnect con1;
disconnect con2;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
DROP FUNCTION f1;
DROP PROCEDURE p1;
DROP USER user_1@localhost;
DROP USER USER_1@localhost;
DROP DATABASE db1;
use test;
# End of 5.0 tests

View File

@@ -150,3 +150,75 @@ select TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES
where TABLE_SCHEMA ='mysqltest_LC2';
use test;
drop database mysqltest_LC2;
--echo # End of 5.1 tests
--echo #
--echo # Test for bug #44738 "fill_schema_table_from_frm() opens tables without
--echo # lowercasing table name". Due to not properly normalizing table names
--echo # in lower_case_table_names modes in this function queries to I_S which
--echo # were executed through it left entries with incorrect key in table
--echo # definition cache. As result further queries to I_S that used this
--echo # function produced stale results in cases when table definition was
--echo # changed by a DDL statement. Also combination of this issue and a
--echo # similar problem in CREATE TABLE (it also has peeked into table
--echo # definition cache using non-normalized key) led to spurious
--echo # ER_TABLE_EXISTS_ERROR errors when one tried to create table with the
--echo # same name as a previously existing but dropped table.
--echo #
--disable_warnings
drop database if exists mysqltest_UPPERCASE;
drop table if exists t_bug44738_UPPERCASE;
--enable_warnings
create database mysqltest_UPPERCASE;
use mysqltest_UPPERCASE;
create table t_bug44738_UPPERCASE (i int) comment='Old comment';
create table t_bug44738_lowercase (i int) comment='Old comment';
select table_schema, table_name, table_comment from information_schema.tables
where table_schema like 'mysqltest_%' and table_name like 't_bug44738_%'
order by table_name;
alter table t_bug44738_UPPERCASE comment='New comment';
alter table t_bug44738_lowercase comment='New comment';
--echo # There should be no stale entries in TDC for our tables after the
--echo # above ALTER TABLE statements so new version of comments should be
--echo # returned by the below query to I_S.
select table_schema, table_name, table_comment from information_schema.tables
where table_schema like 'mysqltest_%' and table_name like 't_bug44738_%'
order by table_name;
drop database mysqltest_UPPERCASE;
use test;
--echo # Let us check that the original test case which led to discovery
--echo # of this problem also works.
create table t_bug44738_UPPERCASE (i int);
select table_schema, table_name, table_comment from information_schema.tables
where table_schema = 'test' and table_name like 't_bug44738_%';
drop table t_bug44738_UPPERCASE;
--echo # After the above DROP TABLE there are no entries in TDC which correspond
--echo # to our table and therefore the below statement should succeed.
create table t_bug44738_UPPERCASE (i int);
drop table t_bug44738_UPPERCASE;
--echo # Finally, let us check that another issue which was exposed by
--echo # the original test case is solved. I.e. that fuse in CREATE TABLE
--echo # which ensures that table is not created if there is an entry for
--echo # it in TDC even though it was removed from disk uses normalized
--echo # version of the table name.
create table t_bug44738_UPPERCASE (i int) engine = myisam;
--echo # Load table definition in TDC.
select table_schema, table_name, table_comment from information_schema.tables
where table_schema = 'test' and table_name like 't_bug44738_%';
--echo # Simulate manual removal of the table.
let $MYSQLD_DATADIR= `select @@datadir`;
--remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.frm
--remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.MYD
--remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.MYI
--echo # After manual removal of table still there should be an entry for table
--echo # in TDC so attempt to create table with the same name should fail.
--error ER_TABLE_EXISTS_ERROR
create table t_bug44738_UPPERCASE (i int);
--echo # And should succeed after FLUSH TABLES.
flush tables;
create table t_bug44738_UPPERCASE (i int);
drop table t_bug44738_UPPERCASE;

View File

@@ -1634,3 +1634,63 @@ DROP TRIGGER tr1;
DROP TABLE t1, t2, t3;
--echo End of 5.1 tests
--echo #
--echo # An additional test case for Bug#27430 Crash in subquery code
--echo # when in PS and table DDL changed after PREPARE
--echo #
--echo # Test merge table with too many merge children.
--echo #
--disable_warnings
drop table if exists t_parent;
--enable_warnings
set @save_table_definition_cache=@@global.table_definition_cache;
--echo #
--echo # Set @@global.table_definition_cache to minimum
--echo #
set @@global.table_definition_cache=400;
set @a=null;
let $1 = 400;
--echo #
--echo # Create 400 merge children
--echo #
--disable_query_log
while ($1)
{
--disable_warnings
eval drop table if exists t$1;
--enable_warnings
eval create table t$1 (a int) engine=myisam;
eval set @a=ifnull(concat(@a, ", ", "t$1"), "t$1");
dec $1;
}
--enable_query_log
set @a=concat("create table t_parent (a int) union(", @a,
") insert_method=first engine=mrg_myisam");
prepare stmt from @a;
execute stmt;
prepare stmt from "select * from t_parent";
--error ER_NEED_REPREPARE
execute stmt;
--error ER_NEED_REPREPARE
execute stmt;
--error ER_NEED_REPREPARE
execute stmt;
deallocate prepare stmt;
--echo #
--echo # Create merge parent
--echo #
--echo #
--echo # Cleanup
--echo #
let $1 = 400;
--disable_query_log
while ($1)
{
eval drop table t$1;
dec $1;
}
--enable_query_log
drop table t_parent;
set @@global.table_definition_cache=@save_table_definition_cache;

View File

@@ -503,6 +503,7 @@ insert into t2 values(2,0);
disconnect root;
connection default;
select straight_join * from t1,t2 force index (primary) where t1.a=t2.a;
unlock tables;
drop table t1,t2;
#
# Full key.
@@ -520,6 +521,7 @@ disconnect con1;
connection default;
SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2
WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1;
UNLOCK TABLES;
DROP TABLE t1,t2;
# End of 4.0 tests
@@ -1539,14 +1541,14 @@ INSERT INTO t1 SELECT a+5120,b FROM t1;
SET myisam_sort_buffer_size=4;
REPAIR TABLE t1;
# !!! Disabled until additional fix for BUG#47073 is pushed.
#SET myisam_repair_threads=2;
SET myisam_repair_threads=2;
# May report different values depending on threads activity.
#--replace_regex /changed from [0-9]+/changed from #/
#REPAIR TABLE t1;
#SET myisam_repair_threads=@@global.myisam_repair_threads;
--disable_result_log
REPAIR TABLE t1;
--enable_result_log
SET myisam_repair_threads=@@global.myisam_repair_threads;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
CHECK TABLE t1;
DROP TABLE t1;
--echo End of 5.1 tests

View File

@@ -8,6 +8,9 @@
--echo # Binary must be compiled with debug for crash to occur
--source include/have_debug.inc
call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:");
call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
let $MYSQLD_DATADIR= `select @@datadir`;
SET GLOBAL delay_key_write=ALL;
CREATE TABLE t1(a INT,
@@ -26,12 +29,6 @@ SET SESSION debug="d,crash_before_flush_keys";
--error 2013
FLUSH TABLE t1;
--echo # Run MYISAMCHK tool to check the table t1 and repair
--replace_result $MYISAMCHK MYISAMCHK $MYSQLD_DATADIR MYSQLD_DATADIR
--error 255
--exec $MYISAMCHK -cs $MYSQLD_DATADIR/test/t1 2>&1
--exec $MYISAMCHK -rs $MYSQLD_DATADIR/test/t1
--echo # Write file to make mysql-test-run.pl start the server
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
@@ -42,8 +39,6 @@ FLUSH TABLE t1;
--echo # it to be back online again
--source include/wait_until_connected_again.inc
SHOW CREATE TABLE t1;
SELECT * FROM t1 FORCE INDEX (PRIMARY);
# Must report that the table wasn't closed properly
CHECK TABLE t1;
DROP TABLE t1;

View File

@@ -1,3 +1,6 @@
-- disable_warnings
DROP TABLE IF EXISTS t1,t2,t3;
-- enable_warnings
#
# BUG#31277 - myisamchk --unpack corrupts a table
#
@@ -105,5 +108,116 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--exec $MYISAMCHK -srq $MYSQLD_DATADIR/mysql_db1/t1
SELECT COUNT(*) FROM mysql_db1.t1 WHERE c2 < 5;
#
# Bug#36573 myisampack --join does not create destination table .frm file
#
#############################################################################
# Testcase myisampack.1: Positive test for myisampack --join
# To test myisampack --join operation creates .frm file
# If it creates .frm file, we will be able to access from mysql
# server
#############################################################################
--echo # ===== myisampack.1 =====
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(20);
let $i=9;
--disable_query_log
while ($i)
{
INSERT INTO t1 SELECT a from t1;
dec $i;
}
--enable_query_log
CREATE TABLE t2(a INT);
INSERT INTO t2 VALUES(40);
let $i=9;
--disable_query_log
while ($i)
{
INSERT INTO t2 SELECT a from t2;
dec $i;
}
--enable_query_log
FLUSH TABLE t1,t2;
--exec $MYISAMPACK --join=$MYSQLD_DATADIR/test/t3 $MYSQLD_DATADIR/test/t1 $MYSQLD_DATADIR/test/t2 2>&1
--echo #If the myisampack --join operation is successful, we have table t3(.frm)
--echo #so we should be able to query about the table from server.
SELECT COUNT(a) FROM t3;
#############################################################################
# Testcase myisampack.2: 2nd Positive test for myisampack --join
# Test myisampack join operation with an existing destination frm file.
# It should finish the join operation successfully
#############################################################################
--echo # ===== myisampack.2 =====
FLUSH TABLE t3;
--remove_file $MYSQLD_DATADIR/test/t3.MYI
--remove_file $MYSQLD_DATADIR/test/t3.MYD
--exec $MYISAMPACK --join=$MYSQLD_DATADIR/test/t3 $MYSQLD_DATADIR/test/t1 $MYSQLD_DATADIR/test/t2 2>&1
--echo #Tests the myisampack join operation with an existing destination .frm file,
--echo #the command should return correct exit status(0) and
--echo #we should be able to query the table.
SELECT COUNT(a) FROM t3;
#############################################################################
# Testcase myisampack.3: 3rd Positive test for myisampack --join
# Test myisampack join operation without frm file for first table and second
# table. It should finish the join operation successfully
#############################################################################
--echo # ===== myisampack.3 =====
--copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLTEST_VARDIR/tmp/bug36573.t1.frm
--copy_file $MYSQLD_DATADIR/test/t2.frm $MYSQLTEST_VARDIR/tmp/bug36573.t2.frm
--remove_file $MYSQLD_DATADIR/test/t1.frm
--remove_file $MYSQLD_DATADIR/test/t2.frm
DROP TABLE t3;
--exec $MYISAMPACK --join=$MYSQLD_DATADIR/test/t3 $MYSQLD_DATADIR/test/t1 $MYSQLD_DATADIR/test/t2 2>&1
--echo #Tests the myisampack join operation without frm file for the first and second table
--echo #No frm file is generated in this and we shouldn't be able to access the newly
--echo #created table
--error ER_NO_SUCH_TABLE
SELECT COUNT(a) FROM t3;
--copy_file $MYSQLTEST_VARDIR/tmp/bug36573.t1.frm $MYSQLD_DATADIR/test/t1.frm
--copy_file $MYSQLTEST_VARDIR/tmp/bug36573.t2.frm $MYSQLD_DATADIR/test/t2.frm
--copy_file $MYSQLTEST_VARDIR/tmp/bug36573.t1.frm $MYSQLD_DATADIR/test/t3.frm
--remove_file $MYSQLTEST_VARDIR/tmp/bug36573.t1.frm
--remove_file $MYSQLTEST_VARDIR/tmp/bug36573.t2.frm
#############################################################################
# Testcase myisampack.4: Negative test for myisampack --join
# Test myisampack join operation with an existing .MYI,.MDI,.frm files
# the test should fail
#############################################################################
--echo # ===== myisampack.4 =====
--echo #Tests the myisampack join operation with an existing destination .frm,.MYI,.MDI
--echo #the command should fail with exit status 2
#
# Note: Use of regular expressions in this file is for output printed in result file
# The main purpose of this regular expression is to supress the filenames for
# error messages produced so that we can create a generic result file
#
#1. /.*myisampack(\.exe)?: Can't create\/write to file .*\(/myisampack: Can't create\/write to file (/
# Replace everything before "myisampack" or "myisampack.exe" and followed by
# ": Can't create\/write to file " until the first open paranthesis , with
# "myisampack: Can't create\/write to file ("
#
#2. /Aborted: .*is/Aborted: file is/
# Replace everything after starting with "Aborted: " until ending with "is" with
# "Aborted: file is/
#
--replace_regex /.*myisampack(\.exe)?: Can't create\/write to file .*\(/myisampack: Can't create\/write to file (/ /Aborted: .*is/Aborted: file is/
--error 2
--exec $MYISAMPACK --join=$MYSQLD_DATADIR/test/t3 $MYSQLD_DATADIR/test/t1 $MYSQLD_DATADIR/test/t2 2>&1
DROP TABLE t1,t2,t3;
DROP TABLE mysql_db1.t1;
DROP DATABASE mysql_db1;

View File

@@ -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
#
@@ -390,10 +398,16 @@ drop tables t1, t2;
#
# Bug #27884: mysql --html does not quote HTML special characters in output
#
--exec $MYSQL --html test -e "select '< & >' as '<'"
--write_file $MYSQLTEST_VARDIR/tmp/bug27884.sql
SELECT '< & >' AS `<`;
EOF
--exec $MYSQL --html test < $MYSQLTEST_VARDIR/tmp/bug27884.sql
remove_file $MYSQLTEST_VARDIR/tmp/bug27884.sql;
#
# Bug #27884: mysql client + null byte
# Bug #28203: mysql client + null byte
#
create table t1 (a char(5));
insert into t1 values ('\0b\0');
@@ -406,5 +420,5 @@ insert into t1 values ('\0b\0');
--exec $MYSQL --xml test -e "select a from t1"
drop table t1;
--echo
--echo End of tests
--echo End of 5.0 tests

View File

@@ -0,0 +1,205 @@
--source include/not_windows.inc
--source include/have_case_sensitive_file_system.inc
#
# Note, please keep this file UTF-8 compatible.
# After editing, make sure that
# "file mysql_locale_posix.test"
# says
# "UTF-8 Unicode text"
# or
# "UTF-8 Unicode English text"
#
#
# Check if we're running on a POSIX-locale machine
#
--disable_query_log
--exec locale -a > $MYSQLTEST_VARDIR/tmp/locale_a.output 2>/dev/null || true
SET @file=REPLACE(LOAD_FILE('../../tmp/locale_a.output'), '-', '');
#
# Note, file content must be case sensitive.
# Some platforms are case sensitive regarding to locale name.
# For example, on HP-UX
# LANG=cs_CZ.iso88592 - works fine
# LANG=cs_CZ.ISO88592 - does not work
#
--remove_file $MYSQLTEST_VARDIR/tmp/locale_a.output
if (`SELECT (IFNULL(@file,'') NOT LIKE '%\nde_DE.iso88591\n%')`)
{
Skip Need POSIX locale de_DE.iso88591;
}
if (`SELECT (IFNULL(@file,'') NOT LIKE '%\nru_RU.koi8r\n%')`)
{
Skip Need POSIX locale ru_RU.koi8r;
}
if (`SELECT (IFNULL(@file,'') NOT LIKE '%\ncs_CZ.iso88592\n%')`)
{
Skip Need POSIX locale cs_CZ.iso88592;
}
if (`SELECT (IFNULL(@file,'') NOT LIKE '%\nen_US.utf8\n%')`)
{
Skip Need POSIX locale en_US.utf8;
}
--enable_query_log
SET NAMES utf8;
--disable_warnings
DROP DATABASE IF EXISTS `ó`;
DROP DATABASE IF EXISTS `Ăł`;
DROP DATABASE IF EXISTS `цЁ`;
DROP DATABASE IF EXISTS `ó`;
--enable_warnings
#
# Test some of the OS-to-MySQL character set mappings
#
# {"ANSI_X3.4-1968", "ascii", my_cs_exact},
# {"ansi1251", "cp1251", my_cs_exact},
# {"armscii8", "armscii8", my_cs_exact},
# {"ASCII", "ascii", my_cs_exact},
# {"Big5", "big5", my_cs_exact},
# {"cp1251", "cp1251", my_cs_exact},
# {"cp1255", "cp1255", my_cs_exact},
# {"CP866", "cp866", my_cs_exact},
# {"eucCN", "gb2312", my_cs_exact},
# {"eucJP", "ujis", my_cs_exact},
# {"eucKR", "euckr", my_cs_exact},
#
# {"gb18030", "gb18030", my_cs_exact},
#
# {"gb2312", "gb2312", my_cs_exact},
# {"gbk", "gbk", my_cs_exact},
# {"georgianps", "geostd8", my_cs_exact},
# {"IBM-1252", "cp1252", my_cs_exact},
#
# {"iso88591", "latin1", my_cs_approx},
# {"ISO_8859-1", "latin1", my_cs_approx},
# {"ISO8859-1", "latin1", my_cs_approx},
# {"ISO-8859-1", "latin1", my_cs_approx},
#
# _utf8 0xC3B3 = LATIN SMALL LETTER O WITH ACUTE
# _latin1 0xC3 = LATIN CAPITAL LETTER A WITH TILDE
# _latin1 0xB3 = SUPERSCRIPT THREE
#
--echo
--echo iso88591
--exec LC_ALL=fi_FI.iso88591 $MYSQL --default-character-set=auto test -e "SELECT @@character_set_client"
--exec LC_ALL=fi_FI.iso88591 $MYSQLADMIN -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-character-set=auto create ó
--exec LC_ALL=fi_FI.iso88591 $MYSQL_SHOW --default-character-set=auto ó
--exec LC_ALL=fi_FI.iso88591 $MYSQL_CHECK --default-character-set=auto "ó"
# {"iso885913", "latin7", my_cs_exact},
# {"ISO_8859-13", "latin7", my_cs_exact},
# {"ISO8859-13", "latin7", my_cs_exact},
# {"ISO-8859-13", "latin7", my_cs_exact},
#
# {"iso885915", "latin9", my_cs_exact},
# {"ISO_8859-15", "latin9", my_cs_exact},
# {"ISO8859-15", "latin9", my_cs_exact},
# {"ISO-8859-15", "latin9", my_cs_exact},
#
# {"iso88592", "latin2", my_cs_exact},
# {"ISO_8859-2", "latin2", my_cs_exact},
# {"ISO8859-2", "latin2", my_cs_exact},
# {"ISO-8859-2", "latin2", my_cs_exact},
#
#
# _utf8 0xC3B3 = LATIN SMALL LETTER O WITH ACUTE
# _latin2 0xC3 = LATIN CAPITAL LETTER A WITH BREVE
# _latin2 0xB3 = LATIN SMALL LETTER L WITH STROKE
#
--echo
--echo iso88592
--exec LC_ALL=cs_CZ.iso88592 $MYSQL --character-sets-dir=$CHARSETSDIR --default-character-set=auto test -e "SELECT @@character_set_client"
--exec LC_ALL=cs_CZ.iso88592 $MYSQLADMIN --character-sets-dir=$CHARSETSDIR -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-character-set=auto create ó
--exec LC_ALL=cs_CZ.iso88592 $MYSQL_SHOW --character-sets-dir=$CHARSETSDIR --default-character-set=auto ó
--exec LC_ALL=cs_CZ.iso88592 $MYSQL_CHECK --character-sets-dir=$CHARSETSDIR--default-character-set=auto "ó"
# {"iso88597", "greek", my_cs_exact},
# {"ISO_8859-7", "greek", my_cs_exact},
# {"ISO8859-7", "greek", my_cs_exact},
# {"ISO-8859-7", "greek", my_cs_exact},
#
# {"iso88598", "hebrew", my_cs_exact},
# {"ISO_8859-8", "hebrew", my_cs_exact},
# {"ISO8859-8", "hebrew", my_cs_exact},
# {"ISO-8859-8", "hebrew", my_cs_exact},
#
# {"iso88599", "latin5", my_cs_exact},
# {"ISO_8859-9", "latin5", my_cs_exact},
# {"ISO8859-9", "latin5", my_cs_exact},
# {"ISO-8859-9", "latin5", my_cs_exact},
#
# {"koi8r", "koi8r", my_cs_exact},
# {"KOI8-R", "koi8r", my_cs_exact},
# {"koi8u", "koi8u", my_cs_exact},
# {"KOI8-U", "koi8u", my_cs_exact},
#
#
# _utf8 0xC3B3 = LATIN SMALL LETTER O WITH ACUTE
# _koi8r 0xC3 = CYRILLIC SMALL LETTER TSE
# _koi8r 0xB3 = CYRILLIC CAPITAL LETTER IO
#
--echo
--echo koi8r
--exec LC_ALL=ru_RU.koi8r $MYSQL --character-sets-dir=$CHARSETSDIR --default-character-set=auto test -e "SELECT @@character_set_client"
--exec LC_ALL=ru_RU.koi8r $MYSQLADMIN --character-sets-dir=$CHARSETSDIR -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-character-set=auto create ó
--exec LC_ALL=ru_RU.koi8r $MYSQL_SHOW --character-sets-dir=$CHARSETSDIR --default-character-set=auto ó
--exec LC_ALL=ru_RU.koi8r $MYSQL_CHECK --character-sets-dir=$CHARSETSDIR --default-character-set=auto "ó"
# {"Shift_JIS", "sjis", my_cs_exact},
# {"SJIS", "sjis", my_cs_exact},
#
# {"tis620", "tis620", my_cs_exact},
#
# {"ujis", "ujis", my_cs_exact},
#
# {"US-ASCII", "ascii", my_cs_exact},
#
# {"utf8", "utf8", my_cs_exact},
# {"utf-8", "utf8", my_cs_exact},
--echo
--echo utf8
--exec LC_ALL=en_US.utf8 $MYSQL --default-character-set=auto test -e "SELECT @@character_set_client"
--exec LC_ALL=en_US.utf8 $MYSQLADMIN -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-character-set=auto create ó
--exec LC_ALL=en_US.utf8 $MYSQL_SHOW --default-character-set=auto ó
--exec LC_ALL=en_US.utf8 $MYSQL_SHOW --default-character-set=auto "ó"
--exec LC_ALL=en_US.utf8 $MYSQL_SHOW --default-character-set=auto "Ăł"
--exec LC_ALL=en_US.utf8 $MYSQL_SHOW --default-character-set=auto "цЁ"
--exec LC_ALL=en_US.utf8 $MYSQL_CHECK --default-character-set=auto ó
--exec LC_ALL=en_US.utf8 $MYSQL_CHECK --default-character-set=auto "ó"
--exec LC_ALL=en_US.utf8 $MYSQL_CHECK --default-character-set=auto "Ăł"
--exec LC_ALL=en_US.utf8 $MYSQL_CHECK --default-character-set=auto "цЁ"
SHOW DATABASES LIKE 'ó';
SHOW DATABASES LIKE 'Ăł';
SHOW DATABASES LIKE 'цЁ';
SHOW DATABASES LIKE 'ó';
DROP DATABASE `ó`;
DROP DATABASE `Ăł`;
DROP DATABASE `цЁ`;
DROP DATABASE `ó`;

View File

@@ -89,3 +89,10 @@ DROP USER mysqltest1@'%';
set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE';
--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
eval set GLOBAL sql_mode=default;
#
# Test the --upgrade-system-tables option
#
--replace_result $MYSQLTEST_VARDIR var
--exec $MYSQL_UPGRADE --skip-verbose --upgrade-system-tables

View File

@@ -4,7 +4,7 @@
# Test "mysqladmin ping"
#
--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
--exec $MYSQLADMIN --no-defaults --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
#
@@ -19,7 +19,7 @@ EOF
--replace_regex /.*mysqladmin.*: unknown/mysqladmin: unknown/
--error 7
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf;
# When mysqladmin finds "loose-database" in .cnf file it shall print
@@ -30,6 +30,6 @@ loose-database=db2
EOF
--replace_regex /Warning: .*mysqladmin.*: unknown/Warning: mysqladmin: unknown/
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf;

View File

@@ -71,8 +71,7 @@ select "--- --position --" as "";
--enable_query_log
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=330 $MYSQLD_DATADIR/master-bin.000002
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=331 $MYSQLD_DATADIR/master-bin.000002
# These are tests for remote binlog.
# They should return the same as previous test.
@@ -108,7 +107,7 @@ select "--- --position --" as "";
--enable_query_log
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=330 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=331 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# Bug#7853 mysqlbinlog does not accept input from stdin
--disable_query_log
@@ -443,3 +442,27 @@ FLUSH LOGS;
--echo End of 5.0 tests
--echo End of 5.1 tests
#
# BUG#38468 Memory leak detected when using mysqlbinlog utility;
#
disable_query_log;
RESET MASTER;
CREATE TABLE t1 SELECT 1;
FLUSH LOGS;
DROP TABLE t1;
enable_query_log;
# Write an empty file for comparison
write_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty;
EOF
# Before fix of BUG#38468, this would generate some warnings
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 >/dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn
# Make sure the command above does not generate any error or warnings
diff_files $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty;
# Cleanup for this part of test
remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty;
remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn;

View File

@@ -50,15 +50,15 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001
--exec $MYSQL_BINLOG --short-form --start-position=609 $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLD_DATADIR/master-bin.000001
--exec $MYSQL_BINLOG --short-form --stop-position=609 $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- start and stop positions ---" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLD_DATADIR/master-bin.000001
--exec $MYSQL_BINLOG --short-form --start-position=609 --stop-position 726 $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -84,11 +84,11 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--exec $MYSQL_BINLOG --short-form --start-position=609 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--exec $MYSQL_BINLOG --short-form --stop-position=135 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -111,15 +111,15 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --start-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--exec $MYSQL_BINLOG --short-form --start-position=609 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --stop-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--exec $MYSQL_BINLOG --short-form --stop-position=609 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- start and stop positions ---" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--exec $MYSQL_BINLOG --short-form --start-position=609 --stop-position 726 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
@@ -142,11 +142,11 @@ select "--- offset --" as "";
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --start-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--exec $MYSQL_BINLOG --short-form --start-position=609 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --stop-position=134 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--exec $MYSQL_BINLOG --short-form --stop-position=135 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log

View File

@@ -178,7 +178,7 @@ SELECT * FROM INFORMATION_SCHEMA.TRIGGERS
WHERE TRIGGER_SCHEMA="#mysql50#a@b" ORDER BY trigger_name;
--echo mysqlcheck --fix-db-names --fix-table-names --all-databases
--exec $MYSQL_CHECK --fix-db-names --fix-table-names --all-databases
--exec $MYSQL_CHECK --default-character-set=utf8 --fix-db-names --fix-table-names --all-databases
USE `a@b`;
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS

View File

@@ -9,6 +9,11 @@ if (`SELECT '$nmp' != 'ON'`){
skip No named pipe support;
}
# Connect using named pipe for testing
connect(pipe_con,localhost,root,,,,,PIPE);
# Source select test case
-- source include/common-tests.inc
connection default;
disconnect pipe_con;

View File

@@ -3,6 +3,8 @@
drop table if exists t1;
--enable_warnings
set @@session.sql_auto_is_null=1;
#
# Test some ODBC compatibility
#
@@ -32,3 +34,5 @@ SELECT sql_no_cache a, last_insert_id() FROM t1;
DROP TABLE t1;
# End of 4.1 tests
set @@session.sql_auto_is_null=default;

View File

@@ -375,4 +375,32 @@ INSERT INTO t1 VALUES(0);
SELECT 1 FROM t1 GROUP BY (DATE(NULL)) WITH ROLLUP;
DROP TABLE t1;
--echo #
--echo # Bug #48131: crash group by with rollup, distinct,
--echo # filesort, with temporary tables
--echo #
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY);
INSERT INTO t1 VALUES (1), (2);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (100);
SELECT a, b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
SELECT DISTINCT b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
DROP TABLE t1, t2;
--echo #
--echo # Bug #48475: DISTINCT is ignored with GROUP BY WITH ROLLUP
--echo # and only const tables
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (b INT);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
SELECT DISTINCT b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
DROP TABLE t1, t2;
--echo End of 5.0 tests

View File

@@ -867,6 +867,31 @@ SELECT
DROP TABLE t1, t2, t3;
--echo #
--echo # Bug #42760: Select doesn't return desired results when we have null
--echo # values
--echo #
CREATE TABLE t1 (
a INT,
c INT,
UNIQUE KEY a_c (a,c),
KEY (a));
INSERT INTO t1 VALUES (1, 10), (2, NULL);
--echo # Must use ref-or-null on the a_c index
EXPLAIN
SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c;
--echo # Must return 1 row
SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c;
DROP TABLE t1;
--echo End of 5.0 tests
#
# Bug #35206: select query result different if the key is indexed or not
#

View File

@@ -109,7 +109,7 @@ create user user_1@localhost;
grant all on mysqltest.* to user_1@localhost;
connect (con28181_1,localhost,user_1,,mysqltest);
--error ER_DBACCESS_DENIED_ERROR
--error ER_ACCESS_DENIED_ERROR
eval select schema_name
into outfile "../../tmp/outfile-test.4"
fields terminated by ',' optionally enclosed by '"'

View File

@@ -14,6 +14,15 @@
drop table if exists t1, t2;
--enable_warnings
#
# Bug#48276: can't add column if subpartition exists
CREATE TABLE t1 (a INT, b INT)
PARTITION BY LIST (a)
SUBPARTITION BY HASH (b)
(PARTITION p1 VALUES IN (1));
ALTER TABLE t1 ADD COLUMN c INT;
DROP TABLE t1;
#
# Bug#46639: 1030 (HY000): Got error 124 from storage engine on
# INSERT ... SELECT ...
@@ -61,6 +70,17 @@ SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
#
# Bug#45904: Error when CHARSET=utf8 and subpartitioning
#
create table t1 (a int NOT NULL, b varchar(5) NOT NULL)
default charset=utf8
partition by list (a)
subpartition by key (b)
(partition p0 values in (1),
partition p1 values in (2));
drop table t1;
#
# Bug#44059: rec_per_key on empty partition gives weird optimiser results
#
@@ -97,6 +117,29 @@ INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 WHERE pk < 0 ORDER BY pk;
DROP TABLE t1;
#
# Bug#35765: ALTER TABLE produces wrong error when non-existent storage engine
# used
CREATE TABLE t1 (a INT)
ENGINE=NonExistentEngine;
DROP TABLE t1;
CREATE TABLE t1 (a INT)
ENGINE=NonExistentEngine
PARTITION BY HASH (a);
DROP TABLE t1;
CREATE TABLE t1 (a INT)
ENGINE=Memory;
ALTER TABLE t1 ENGINE=NonExistentEngine;
# OK to only specify one partitions engine, since it is already assigned at
# table level (after create, it is specified on all levels and all parts).
ALTER TABLE t1
PARTITION BY HASH (a)
(PARTITION p0 ENGINE=Memory,
PARTITION p1 ENGINE=NonExistentEngine);
ALTER TABLE t1 ENGINE=NonExistentEngine;
SHOW CREATE TABLE t1;
DROP TABLE t1;
#
# Bug#40494: Crash MYSQL server crashes on range access with partitioning
# and order by
@@ -352,12 +395,12 @@ drop table t1;
#
# BUG 16002: Handle unsigned integer functions properly
#
--error ER_PARSE_ERROR
--error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
create table t1 (a bigint)
partition by range (a)
(partition p0 values less than (0xFFFFFFFFFFFFFFFF),
partition p1 values less than (10));
--error ER_PARSE_ERROR
--error ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
create table t1 (a bigint)
partition by list (a)
(partition p0 values in (0xFFFFFFFFFFFFFFFF),
@@ -1390,7 +1433,7 @@ PARTITION BY LIST (a)
SHOW CREATE TABLE t1;
DROP TABLE t1;
--error ER_PARSE_ERROR
--error ER_NULL_IN_VALUES_LESS_THAN
CREATE TABLE t1 (a int)
PARTITION BY RANGE(a)
(PARTITION p0 VALUES LESS THAN (NULL));
@@ -2031,31 +2074,35 @@ DROP TABLE t1;
--echo #
--echo # Bug #45807: crash accessing partitioned table and sql_mode
--echo # contains ONLY_FULL_GROUP_BY
--echo # Bug#46923: select count(*) from partitioned table fails with
--echo # ONLY_FULL_GROUP_BY
--echo #
SET SESSION SQL_MODE='ONLY_FULL_GROUP_BY';
CREATE TABLE t1(id INT,KEY(id)) ENGINE=MYISAM
PARTITION BY HASH(id) PARTITIONS 2;
SELECT COUNT(*) FROM t1;
DROP TABLE t1;
SET SESSION SQL_MODE=DEFAULT;
--echo #
--echo # BUG#45816 - assertion failure with index containing double
--echo # column on partitioned table
--echo #
CREATE TABLE t1 (
a INT DEFAULT NULL,
b DOUBLE DEFAULT NULL,
c INT DEFAULT NULL,
KEY idx2(b,a)
) PARTITION BY HASH(c) PARTITIONS 3;
INSERT INTO t1 VALUES (6,8,9);
INSERT INTO t1 VALUES (6,8,10);
SELECT 1 FROM t1 JOIN t1 AS t2 USING (a) FOR UPDATE;
DROP TABLE t1;
# This testcase is commented due to the Bug #46853
# Should be uncommented after fixing Bug #46853
#--echo #
#--echo # BUG#45816 - assertion failure with index containing double
#--echo # column on partitioned table
#--echo #
#
#CREATE TABLE t1 (
# a INT DEFAULT NULL,
# b DOUBLE DEFAULT NULL,
# c INT DEFAULT NULL,
# KEY idx2(b,a)
#) PARTITION BY HASH(c) PARTITIONS 3;
#
#INSERT INTO t1 VALUES (6,8,9);
#INSERT INTO t1 VALUES (6,8,10);
#
#SELECT 1 FROM t1 JOIN t1 AS t2 USING (a) FOR UPDATE;
#
#DROP TABLE t1;
--echo End of 5.1 tests

View File

@@ -10,6 +10,27 @@
--source include/have_partition.inc
--source include/have_archive.inc
let $MYSQLD_DATADIR= `select @@datadir`;
#
# Bug#44622: Using PARTITIONs with ARCHIVE engine reports 0 bytes in i_s.TABLES
#
CREATE TABLE t1 (f1 DATE NOT NULL)
ENGINE = ARCHIVE PARTITION BY RANGE (TO_DAYS(f1))
(partition p1 values less than (733751),
partition p2 values less than MAXVALUE);
INSERT INTO t1 VALUES(CURRENT_DATE);
SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
DROP TABLE t1;
CREATE TABLE t1 (f1 DATE NOT NULL)
ENGINE = ARCHIVE;
INSERT INTO t1 VALUES(CURRENT_DATE);
SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
DROP TABLE t1;
#
# Bug 17310 Partitions: Bugs with archived partitioned tables

Some files were not shown because too many files have changed in this diff Show More