mirror of
https://github.com/MariaDB/server.git
synced 2025-11-12 10:22:39 +03:00
Merge bk-internal:/home/bk/mysql-5.1-maint
into siva.hindu.god:/usr/home/tim/m/bk/tmp/51-mrg50
This commit is contained in:
23
mysql-test/include/loaddata_autocom.inc
Normal file
23
mysql-test/include/loaddata_autocom.inc
Normal file
@@ -0,0 +1,23 @@
|
||||
# Test if the engine does autocommit in LOAD DATA INFILE, or not
|
||||
# (NDB wants to do, others don't).
|
||||
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
# NDB does not support the create option 'Binlog of table with BLOB attribute and no PK'
|
||||
# So use a dummy PK here.
|
||||
create table t1 (id int unsigned not null auto_increment primary key, a text, b text);
|
||||
start transaction;
|
||||
load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
|
||||
commit;
|
||||
select count(*) from t1;
|
||||
truncate table t1;
|
||||
start transaction;
|
||||
load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
|
||||
rollback;
|
||||
select count(*) from t1;
|
||||
|
||||
drop table t1;
|
||||
@@ -1340,6 +1340,19 @@ select a from t1 group by a;
|
||||
a
|
||||
e
|
||||
drop table t1;
|
||||
set names utf8;
|
||||
grant select on test.* to юзер_юзер@localhost;
|
||||
user()
|
||||
юзер_юзер@localhost
|
||||
revoke all on test.* from юзер_юзер@localhost;
|
||||
drop user юзер_юзер@localhost;
|
||||
create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
|
||||
use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
|
||||
select database();
|
||||
database()
|
||||
имя_базы_в_кодировке_утф8_длиной_больше_чем_45
|
||||
drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
|
||||
use test;
|
||||
CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8;
|
||||
INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
|
||||
SELECT id FROM t1;
|
||||
|
||||
@@ -76,3 +76,17 @@ a
|
||||
a
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
|
||||
explain select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using temporary
|
||||
select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
c
|
||||
7
|
||||
explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using temporary
|
||||
select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
c
|
||||
28
|
||||
|
||||
21
mysql-test/r/loaddata_autocom_innodb.result
Normal file
21
mysql-test/r/loaddata_autocom_innodb.result
Normal file
@@ -0,0 +1,21 @@
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
drop table if exists t1;
|
||||
create table t1 (id int unsigned not null auto_increment primary key, a text, b text);
|
||||
start transaction;
|
||||
load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
|
||||
Warnings:
|
||||
Warning 1261 Row 3 doesn't contain data for all columns
|
||||
commit;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
4
|
||||
truncate table t1;
|
||||
start transaction;
|
||||
load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
|
||||
Warnings:
|
||||
Warning 1261 Row 3 doesn't contain data for all columns
|
||||
rollback;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
drop table t1;
|
||||
23
mysql-test/r/loaddata_autocom_ndb.result
Normal file
23
mysql-test/r/loaddata_autocom_ndb.result
Normal file
@@ -0,0 +1,23 @@
|
||||
SET SESSION STORAGE_ENGINE = ndbcluster;
|
||||
drop table if exists t1;
|
||||
create table t1 (id int unsigned not null auto_increment primary key, a text, b text);
|
||||
start transaction;
|
||||
load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
|
||||
Warnings:
|
||||
Warning 1261 Row 3 doesn't contain data for all columns
|
||||
commit;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
4
|
||||
truncate table t1;
|
||||
start transaction;
|
||||
load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
|
||||
Warnings:
|
||||
Warning 1261 Row 3 doesn't contain data for all columns
|
||||
rollback;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
4
|
||||
drop table t1;
|
||||
@@ -949,18 +949,24 @@ COUNT(*)
|
||||
Warnings:
|
||||
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1
|
||||
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '20050327 invalid'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '20050327 invalid'
|
||||
SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050328 invalid';
|
||||
COUNT(*)
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Incorrect datetime value: '20050328 invalid' for column 'date' at row 1
|
||||
Warning 1292 Incorrect datetime value: '20050328 invalid' for column 'date' at row 1
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '20050328 invalid'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '20050328 invalid'
|
||||
SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 invalid';
|
||||
COUNT(*)
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1
|
||||
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '20050327 invalid'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '20050327 invalid'
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
|
||||
@@ -896,3 +896,48 @@ EXPLAIN SELECT * FROM t1 WHERE 0 NOT BETWEEN b AND c;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge idx1,idx2 idx1,idx2 4,4 NULL 4 Using sort_union(idx1,idx2); Using where
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
item char(20) NOT NULL default '',
|
||||
started datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
price decimal(16,3) NOT NULL default '0.000',
|
||||
PRIMARY KEY (item,started)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES
|
||||
('A1','2005-11-01 08:00:00',1000),
|
||||
('A1','2005-11-15 00:00:00',2000),
|
||||
('A1','2005-12-12 08:00:00',3000),
|
||||
('A2','2005-12-01 08:00:00',1000);
|
||||
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using where
|
||||
Warnings:
|
||||
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
|
||||
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
|
||||
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
||||
item started price
|
||||
A1 2005-11-01 08:00:00 1000.000
|
||||
A1 2005-11-15 00:00:00 2000.000
|
||||
Warnings:
|
||||
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
|
||||
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
|
||||
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
|
||||
item started price
|
||||
A1 2005-11-01 08:00:00 1000.000
|
||||
A1 2005-11-15 00:00:00 2000.000
|
||||
DROP INDEX `PRIMARY` ON t1;
|
||||
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
Warnings:
|
||||
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
|
||||
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
||||
item started price
|
||||
A1 2005-11-01 08:00:00 1000.000
|
||||
A1 2005-11-15 00:00:00 2000.000
|
||||
Warnings:
|
||||
Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
|
||||
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
|
||||
item started price
|
||||
A1 2005-11-01 08:00:00 1000.000
|
||||
A1 2005-11-15 00:00:00 2000.000
|
||||
DROP TABLE t1;
|
||||
|
||||
103
mysql-test/r/rpl_ndb_innodb_trans.result
Normal file
103
mysql-test/r/rpl_ndb_innodb_trans.result
Normal file
@@ -0,0 +1,103 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
create table t1 (a int, unique(a)) engine=ndbcluster;
|
||||
create table t2 (a int, unique(a)) engine=innodb;
|
||||
begin;
|
||||
insert into t1 values(1);
|
||||
insert into t2 values(1);
|
||||
rollback;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
0
|
||||
begin;
|
||||
load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
|
||||
Warnings:
|
||||
Warning 1262 Row 1 was truncated; it contained more data than there were input columns
|
||||
Warning 1262 Row 2 was truncated; it contained more data than there were input columns
|
||||
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
|
||||
Warnings:
|
||||
Warning 1262 Row 1 was truncated; it contained more data than there were input columns
|
||||
Warning 1262 Row 2 was truncated; it contained more data than there were input columns
|
||||
rollback;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
0
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
begin;
|
||||
load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
|
||||
Warnings:
|
||||
Warning 1262 Row 1 was truncated; it contained more data than there were input columns
|
||||
Warning 1262 Row 2 was truncated; it contained more data than there were input columns
|
||||
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
|
||||
Warnings:
|
||||
Warning 1262 Row 1 was truncated; it contained more data than there were input columns
|
||||
Warning 1262 Row 2 was truncated; it contained more data than there were input columns
|
||||
rollback;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
0
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
begin;
|
||||
insert into t2 values(3),(4);
|
||||
insert into t1 values(3),(4);
|
||||
load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
|
||||
Warnings:
|
||||
Warning 1262 Row 1 was truncated; it contained more data than there were input columns
|
||||
Warning 1262 Row 2 was truncated; it contained more data than there were input columns
|
||||
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
|
||||
Warnings:
|
||||
Warning 1262 Row 1 was truncated; it contained more data than there were input columns
|
||||
Warning 1262 Row 2 was truncated; it contained more data than there were input columns
|
||||
rollback;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
4
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
4
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
0
|
||||
drop table t1,t2;
|
||||
@@ -1069,6 +1069,23 @@ explain select a from t1 group by a;
|
||||
select a from t1 group by a;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#20393: User name truncation in mysql client
|
||||
# Bug#21432: Database/Table name limited to 64 bytes, not chars, problems with multi-byte
|
||||
#
|
||||
set names utf8;
|
||||
#create user юзер_юзер@localhost;
|
||||
grant select on test.* to юзер_юзер@localhost;
|
||||
--exec $MYSQL --default-character-set=utf8 --user=юзер_юзер -e "select user()"
|
||||
revoke all on test.* from юзер_юзер@localhost;
|
||||
drop user юзер_юзер@localhost;
|
||||
|
||||
create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
|
||||
use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
|
||||
select database();
|
||||
drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
|
||||
use test;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
||||
@@ -60,4 +60,14 @@ select 1 as a from t1 union all select 1 from dual limit 1;
|
||||
(select 1 as a from t1) union all (select 1 from dual) limit 1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #21787: COUNT(*) + ORDER BY + LIMIT returns wrong result
|
||||
#
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
|
||||
explain select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
4
mysql-test/t/loaddata_autocom_innodb.test
Normal file
4
mysql-test/t/loaddata_autocom_innodb.test
Normal file
@@ -0,0 +1,4 @@
|
||||
--source include/have_innodb.inc
|
||||
let $engine_type= InnoDB;
|
||||
|
||||
--source include/loaddata_autocom.inc
|
||||
4
mysql-test/t/loaddata_autocom_ndb.test
Normal file
4
mysql-test/t/loaddata_autocom_ndb.test
Normal file
@@ -0,0 +1,4 @@
|
||||
--source include/have_ndb.inc
|
||||
let $engine_type=ndbcluster;
|
||||
|
||||
--source include/loaddata_autocom.inc
|
||||
@@ -709,5 +709,34 @@ EXPLAIN SELECT * FROM t1 WHERE 0 NOT BETWEEN b AND c;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #16249: different results for a range with an without index
|
||||
# when a range condition use an invalid datetime constant
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
item char(20) NOT NULL default '',
|
||||
started datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
price decimal(16,3) NOT NULL default '0.000',
|
||||
PRIMARY KEY (item,started)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
INSERT INTO t1 VALUES
|
||||
('A1','2005-11-01 08:00:00',1000),
|
||||
('A1','2005-11-15 00:00:00',2000),
|
||||
('A1','2005-12-12 08:00:00',3000),
|
||||
('A2','2005-12-01 08:00:00',1000);
|
||||
|
||||
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
||||
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
||||
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
|
||||
|
||||
DROP INDEX `PRIMARY` ON t1;
|
||||
|
||||
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
||||
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
|
||||
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
||||
1
mysql-test/t/rpl_ndb_innodb_trans-slave.opt
Normal file
1
mysql-test/t/rpl_ndb_innodb_trans-slave.opt
Normal file
@@ -0,0 +1 @@
|
||||
--innodb
|
||||
66
mysql-test/t/rpl_ndb_innodb_trans.test
Normal file
66
mysql-test/t/rpl_ndb_innodb_trans.test
Normal file
@@ -0,0 +1,66 @@
|
||||
# Test of a transaction mixing the two engines
|
||||
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
create table t1 (a int, unique(a)) engine=ndbcluster;
|
||||
create table t2 (a int, unique(a)) engine=innodb;
|
||||
|
||||
|
||||
begin;
|
||||
insert into t1 values(1);
|
||||
insert into t2 values(1);
|
||||
rollback;
|
||||
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
sync_slave_with_master;
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
connection master;
|
||||
|
||||
begin;
|
||||
load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
|
||||
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
|
||||
rollback;
|
||||
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
sync_slave_with_master;
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
connection master;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
begin;
|
||||
load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
|
||||
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
|
||||
rollback;
|
||||
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
sync_slave_with_master;
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
connection master;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
begin;
|
||||
insert into t2 values(3),(4);
|
||||
insert into t1 values(3),(4);
|
||||
load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
|
||||
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
|
||||
rollback;
|
||||
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
sync_slave_with_master;
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
connection master;
|
||||
|
||||
drop table t1,t2;
|
||||
sync_slave_with_master;
|
||||
Reference in New Issue
Block a user