Merge 5.5-mwl248 -> 10.0-base

This commit is contained in:
Igor Babaev 2013-01-08 19:34:33 -08:00
commit f853333e09
54 changed files with 2575 additions and 1676 deletions

View File

@ -1932,7 +1932,9 @@ static void print_xml_row(FILE *xml_file, const char *row_name,
{
create_stmt_ptr= (*row)[i];
create_stmt_len= lengths[i];
#ifndef DBUG_OFF
body_found= 1;
#endif
}
else
{

View File

@ -18,8 +18,8 @@ export DEB_BUILD_OPTIONS="nocheck"
# Find major.minor version.
#
source ./VERSION
UPSTREAM="${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_PATCH}"
RELEASE_EXTRA=${MYSQL_VERSION_EXTRA}
UPSTREAM="${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_PATCH}${MYSQL_VERSION_EXTRA}"
RELEASE_EXTRA=""
RELEASE_NAME=mariadb
PATCHLEVEL=""

View File

@ -51,9 +51,6 @@ word32 PBKDF2_HMAC<T>::DeriveKey(byte* derived, word32 dLen, const byte* pwd,
if (dLen > MaxDerivedKeyLength())
return 0;
if (iterations < 0)
return 0;
ByteBlock buffer(T::DIGEST_SIZE);
HMAC<T> hmac;

View File

@ -2403,3 +2403,30 @@ a b
1 1
drop table t1;
#
# Checking that CREATE IF NOT EXISTS is not blocked by running SELECT
#
create table t1 (a int, b int) engine=myisam;
create table t2 (a int, b int) engine=myisam;
insert into t1 values (1,1);
lock tables t1 read;
set @@lock_wait_timeout=5;
create table if not exists t1 (a int, b int);
Warnings:
Note 1050 Table 't1' already exists
create table if not exists t1 (a int, b int) select 2,2;
Warnings:
Note 1050 Table 't1' already exists
create table if not exists t1 like t2;
Warnings:
Note 1050 Table 't1' already exists
create table t1 (a int, b int);
ERROR 42S01: Table 't1' already exists
create table t1 (a int, b int) select 2,2;
ERROR 42S01: Table 't1' already exists
create table t1 like t2;
ERROR 42S01: Table 't1' already exists
select * from t1;
a b
1 1
unlock tables;
drop table t1,t2;

View File

@ -1940,6 +1940,26 @@ event_object_table trigger_name
# Switching to connection 'default'.
#
#
# MDEV-3818: Query against view over IS tables worse than equivalent query without view
#
create view v1 as select table_schema, table_name, column_name from information_schema.columns;
explain extended
select column_name from v1
where (table_schema = "osm") and (table_name = "test");
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE columns ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL NULL Using where; Open_frm_only; Scanned 0 databases
Warnings:
Note 1003 select `information_schema`.`columns`.`COLUMN_NAME` AS `column_name` from `information_schema`.`columns` where ((`information_schema`.`columns`.`TABLE_SCHEMA` = 'osm') and (`information_schema`.`columns`.`TABLE_NAME` = 'test'))
explain extended
select information_schema.columns.column_name as column_name
from information_schema.columns
where (information_schema.columns.table_schema = 'osm') and (information_schema.columns.table_name = 'test');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE columns ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL NULL Using where; Open_frm_only; Scanned 0 databases
Warnings:
Note 1003 select `information_schema`.`columns`.`COLUMN_NAME` AS `column_name` from `information_schema`.`columns` where ((`information_schema`.`columns`.`TABLE_SCHEMA` = 'osm') and (`information_schema`.`columns`.`TABLE_NAME` = 'test'))
drop view v1;
#
# Clean-up.
drop database mysqltest;
#

View File

@ -2247,5 +2247,36 @@ MAX(a) bb
NULL NULL
drop table t1, t2;
set optimizer_switch=@subselect4_tmp;
#
# MDEV-3899 Valgrind warnings (blocks are definitely lost) in filesort on IN subquery with SUM and DISTINCT
#
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(9);
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (8);
SELECT * FROM t1
WHERE (1, 1) IN (SELECT a, SUM(DISTINCT a) FROM t1, t2 GROUP BY a);
a
1
9
drop table t1, t2;
#
# MDEV-3902 Assertion `record_length == m_record_length' failed at Filesort_buffer::alloc_sort_buffer
#
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (pk INT PRIMARY KEY, b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,1),(2,7);
CREATE TABLE t3 (c INT) ENGINE=MyISAM;
INSERT INTO t3 VALUES (8);
SELECT * FROM t1
WHERE (1, 5) IN (SELECT b, SUM(DISTINCT b) FROM t2, t3 GROUP BY b);
a
SELECT * FROM t2 AS alias1, t2 AS alias2
WHERE EXISTS ( SELECT 1 ) AND (alias2.pk = alias1.b )
ORDER BY alias1.b;
pk b pk b
1 1 1 1
drop table t1, t2, t3;
SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size;

View File

@ -11,6 +11,7 @@ Note 1265 Data truncated for column 'c1' at row 1
INSERT IGNORE INTO t1 (c1) VALUES(NOW());
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
Warning 1062 Duplicate entry '2007-02-13' for key 'c1'
SELECT * FROM t1;
c1
2007-02-13
@ -20,6 +21,8 @@ CREATE TABLE t1(c1 YEAR NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(1999);
INSERT INTO t1 (c1) VALUES(2000);
INSERT IGNORE INTO t1 (c1) VALUES(1999);
Warnings:
Warning 1062 Duplicate entry '1999' for key 'c1'
SELECT * FROM t1;
c1
1999
@ -36,6 +39,7 @@ Note 1265 Data truncated for column 'c1' at row 1
INSERT IGNORE INTO t1 (c1) VALUES(NOW());
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
Warning 1062 Duplicate entry '09:09:33' for key 'c1'
SELECT * FROM t1;
c1
09:09:33
@ -45,6 +49,8 @@ CREATE TABLE t1(c1 YEAR NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(1999);
INSERT INTO t1 (c1) VALUES(2000);
INSERT IGNORE INTO t1 (c1) VALUES(1999);
Warnings:
Warning 1062 Duplicate entry '1999' for key 'c1'
SELECT * FROM t1;
c1
1999
@ -55,6 +61,8 @@ SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1) VALUES(NOW());
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
INSERT IGNORE INTO t1 (c1) VALUES(NOW());
Warnings:
Warning 1062 Duplicate entry '2007-02-13 09:09:33' for key 'c1'
SELECT * FROM t1;
c1
2007-02-13 09:09:33
@ -64,6 +72,8 @@ CREATE TABLE t1(c1 YEAR NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(1999);
INSERT INTO t1 (c1) VALUES(2000);
INSERT IGNORE INTO t1 (c1) VALUES(1999);
Warnings:
Warning 1062 Duplicate entry '1999' for key 'c1'
SELECT * FROM t1;
c1
1999
@ -74,6 +84,8 @@ SET TIMESTAMP=1171346973;
INSERT INTO t1 (c1) VALUES(NOW());
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
INSERT IGNORE INTO t1 (c1) VALUES(NOW());
Warnings:
Warning 1062 Duplicate entry '2007-02-13 09:09:33' for key 'c1'
SELECT * FROM t1;
c1
2007-02-13 09:09:33
@ -83,6 +95,8 @@ CREATE TABLE t1(c1 YEAR NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(1999);
INSERT INTO t1 (c1) VALUES(2000);
INSERT IGNORE INTO t1 (c1) VALUES(1999);
Warnings:
Warning 1062 Duplicate entry '1999' for key 'c1'
SELECT * FROM t1;
c1
1999

View File

@ -27,11 +27,13 @@ Warnings:
Note 1265 Data truncated for column 'c1' at row 1
Note 1265 Data truncated for column 'c2' at row 1
Note 1265 Data truncated for column 'c3' at row 1
Warning 1062 Duplicate entry '2007-02-13-2007-02-13-2007-02-13' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01'));
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
Note 1265 Data truncated for column 'c2' at row 1
Note 1265 Data truncated for column 'c3' at row 1
Warning 1062 Duplicate entry '2007-02-13-2007-02-13-2007-02-14' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
2007-02-13 2007-02-13 2007-02-13
@ -45,7 +47,11 @@ INSERT INTO t1 (c1,c2,c3) VALUES(1999,1999,2000);
INSERT INTO t1 (c1,c2,c3) VALUES(1999,2000,1999);
INSERT INTO t1 (c1,c2,c3) VALUES(2000,1999,1999);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(1999,1999,1999);
Warnings:
Warning 1062 Duplicate entry '1999-1999-1999' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(1999,1999,2000);
Warnings:
Warning 1062 Duplicate entry '1999-1999-2000' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
1999 1999 1999
@ -80,11 +86,13 @@ Warnings:
Note 1265 Data truncated for column 'c1' at row 1
Note 1265 Data truncated for column 'c2' at row 1
Note 1265 Data truncated for column 'c3' at row 1
Warning 1062 Duplicate entry '09:09:33-09:09:33-09:09:33' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01'));
Warnings:
Note 1265 Data truncated for column 'c1' at row 1
Note 1265 Data truncated for column 'c2' at row 1
Note 1265 Data truncated for column 'c3' at row 1
Warning 1062 Duplicate entry '09:09:33-09:09:33-10:10:34' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
09:09:33 09:09:33 09:09:33
@ -98,7 +106,11 @@ INSERT INTO t1 (c1,c2,c3) VALUES(1999,1999,2000);
INSERT INTO t1 (c1,c2,c3) VALUES(1999,2000,1999);
INSERT INTO t1 (c1,c2,c3) VALUES(2000,1999,1999);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(1999,1999,1999);
Warnings:
Warning 1062 Duplicate entry '1999-1999-1999' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(1999,1999,2000);
Warnings:
Warning 1062 Duplicate entry '1999-1999-2000' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
1999 1999 1999
@ -113,7 +125,11 @@ INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01'));
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),ADDTIME(NOW(),'1 01:01:01'),NOW());
INSERT INTO t1 (c1,c2,c3) VALUES(ADDTIME(NOW(),'1 01:01:01'),NOW(),NOW());
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
Warnings:
Warning 1062 Duplicate entry '2007-02-13 09:09:33-2007-02-13 09:09:33-2007-02-13 09:09:33' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01'));
Warnings:
Warning 1062 Duplicate entry '2007-02-13 09:09:33-2007-02-13 09:09:33-2007-02-14 10:10:34' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
2007-02-13 09:09:33 2007-02-13 09:09:33 2007-02-13 09:09:33
@ -127,7 +143,11 @@ INSERT INTO t1 (c1,c2,c3) VALUES(1999,1999,2000);
INSERT INTO t1 (c1,c2,c3) VALUES(1999,2000,1999);
INSERT INTO t1 (c1,c2,c3) VALUES(2000,1999,1999);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(1999,1999,1999);
Warnings:
Warning 1062 Duplicate entry '1999-1999-1999' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(1999,1999,2000);
Warnings:
Warning 1062 Duplicate entry '1999-1999-2000' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
1999 1999 1999
@ -142,7 +162,11 @@ INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01'));
INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),ADDTIME(NOW(),'1 01:01:01'),NOW());
INSERT INTO t1 (c1,c2,c3) VALUES(ADDTIME(NOW(),'1 01:01:01'),NOW(),NOW());
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
Warnings:
Warning 1062 Duplicate entry '2007-02-13 09:09:33-2007-02-13 09:09:33-2007-02-13 09:09:33' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),ADDTIME(NOW(),'1 01:01:01'));
Warnings:
Warning 1062 Duplicate entry '2007-02-13 09:09:33-2007-02-13 09:09:33-2007-02-14 10:10:34' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
2007-02-13 09:09:33 2007-02-13 09:09:33 2007-02-13 09:09:33
@ -156,7 +180,11 @@ INSERT INTO t1 (c1,c2,c3) VALUES(1999,1999,2000);
INSERT INTO t1 (c1,c2,c3) VALUES(1999,2000,1999);
INSERT INTO t1 (c1,c2,c3) VALUES(2000,1999,1999);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(1999,1999,1999);
Warnings:
Warning 1062 Duplicate entry '1999-1999-1999' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(1999,1999,2000);
Warnings:
Warning 1062 Duplicate entry '1999-1999-2000' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
1999 1999 1999

View File

@ -8,8 +8,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES(11,11,10);
INSERT INTO t1 (c1,c2,c3) VALUES(11,10,11);
INSERT INTO t1 (c1,c2,c3) VALUES(10,11,11);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,10);
Warnings:
Warning 1062 Duplicate entry '10-10-10' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,11);
Warnings:
Warning 1062 Duplicate entry '10-10-11' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,11,11);
Warnings:
Warning 1062 Duplicate entry '10-11-11' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
10 10 10
@ -29,8 +35,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES(11,11,10);
INSERT INTO t1 (c1,c2,c3) VALUES(11,10,11);
INSERT INTO t1 (c1,c2,c3) VALUES(10,11,11);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,10);
Warnings:
Warning 1062 Duplicate entry '10-10-10' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,11);
Warnings:
Warning 1062 Duplicate entry '10-10-11' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,11,11);
Warnings:
Warning 1062 Duplicate entry '10-11-11' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
10 10 10
@ -50,8 +62,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES(11,11,10);
INSERT INTO t1 (c1,c2,c3) VALUES(11,10,11);
INSERT INTO t1 (c1,c2,c3) VALUES(10,11,11);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,10);
Warnings:
Warning 1062 Duplicate entry '10-10-10' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,11);
Warnings:
Warning 1062 Duplicate entry '10-10-11' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,11,11);
Warnings:
Warning 1062 Duplicate entry '10-11-11' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
10 10 10
@ -71,8 +89,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES(11,11,10);
INSERT INTO t1 (c1,c2,c3) VALUES(11,10,11);
INSERT INTO t1 (c1,c2,c3) VALUES(10,11,11);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,10);
Warnings:
Warning 1062 Duplicate entry '10-10-10' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,11);
Warnings:
Warning 1062 Duplicate entry '10-10-11' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,11,11);
Warnings:
Warning 1062 Duplicate entry '10-11-11' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
10 10 10
@ -92,8 +116,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES(11,11,10);
INSERT INTO t1 (c1,c2,c3) VALUES(11,10,11);
INSERT INTO t1 (c1,c2,c3) VALUES(10,11,11);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,10);
Warnings:
Warning 1062 Duplicate entry '10-10-10' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,11);
Warnings:
Warning 1062 Duplicate entry '10-10-11' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,11,11);
Warnings:
Warning 1062 Duplicate entry '10-11-11' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
10 10 10
@ -113,8 +143,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES(11,11,10);
INSERT INTO t1 (c1,c2,c3) VALUES(11,10,11);
INSERT INTO t1 (c1,c2,c3) VALUES(10,11,11);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,10);
Warnings:
Warning 1062 Duplicate entry '10-10-10' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,11);
Warnings:
Warning 1062 Duplicate entry '10-10-11' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,11,11);
Warnings:
Warning 1062 Duplicate entry '10-11-11' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
10 10 10
@ -134,8 +170,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES(11,11,10);
INSERT INTO t1 (c1,c2,c3) VALUES(11,10,11);
INSERT INTO t1 (c1,c2,c3) VALUES(10,11,11);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,10);
Warnings:
Warning 1062 Duplicate entry '10-10-10' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,11);
Warnings:
Warning 1062 Duplicate entry '10-10-11' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,11,11);
Warnings:
Warning 1062 Duplicate entry '10-11-11' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
10 10 10
@ -155,8 +197,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES(11,11,10);
INSERT INTO t1 (c1,c2,c3) VALUES(11,10,11);
INSERT INTO t1 (c1,c2,c3) VALUES(10,11,11);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,10);
Warnings:
Warning 1062 Duplicate entry '10-10-10' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,11);
Warnings:
Warning 1062 Duplicate entry '10-10-11' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,11,11);
Warnings:
Warning 1062 Duplicate entry '10-11-11' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
10 10 10
@ -176,8 +224,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES(11,11,10);
INSERT INTO t1 (c1,c2,c3) VALUES(11,10,11);
INSERT INTO t1 (c1,c2,c3) VALUES(10,11,11);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,10);
Warnings:
Warning 1062 Duplicate entry '10-10-10' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,11);
Warnings:
Warning 1062 Duplicate entry '10-10-11' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,11,11);
Warnings:
Warning 1062 Duplicate entry '10-11-11' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
10 10 10
@ -197,8 +251,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES(11,11,10);
INSERT INTO t1 (c1,c2,c3) VALUES(11,10,11);
INSERT INTO t1 (c1,c2,c3) VALUES(10,11,11);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,10);
Warnings:
Warning 1062 Duplicate entry '10-10-10' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,11);
Warnings:
Warning 1062 Duplicate entry '10-10-11' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,11,11);
Warnings:
Warning 1062 Duplicate entry '10-11-11' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
10 10 10
@ -218,8 +278,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES(11,11,10);
INSERT INTO t1 (c1,c2,c3) VALUES(11,10,11);
INSERT INTO t1 (c1,c2,c3) VALUES(10,11,11);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,10);
Warnings:
Warning 1062 Duplicate entry '10-10-10' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,11);
Warnings:
Warning 1062 Duplicate entry '10-10-11' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,11,11);
Warnings:
Warning 1062 Duplicate entry '10-11-11' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
10 10 10
@ -239,8 +305,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES(11,11,10);
INSERT INTO t1 (c1,c2,c3) VALUES(11,10,11);
INSERT INTO t1 (c1,c2,c3) VALUES(10,11,11);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,10);
Warnings:
Warning 1062 Duplicate entry '10-10-10' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,11);
Warnings:
Warning 1062 Duplicate entry '10-10-11' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,11,11);
Warnings:
Warning 1062 Duplicate entry '10-11-11' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
10 10 10
@ -260,8 +332,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES(11,11,10);
INSERT INTO t1 (c1,c2,c3) VALUES(11,10,11);
INSERT INTO t1 (c1,c2,c3) VALUES(10,11,11);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,10);
Warnings:
Warning 1062 Duplicate entry '10-10-10' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,11);
Warnings:
Warning 1062 Duplicate entry '10-10-11' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,11,11);
Warnings:
Warning 1062 Duplicate entry '10-11-11' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
10 10 10
@ -281,8 +359,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES(11,11,10);
INSERT INTO t1 (c1,c2,c3) VALUES(11,10,11);
INSERT INTO t1 (c1,c2,c3) VALUES(10,11,11);
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,10);
Warnings:
Warning 1062 Duplicate entry '10-10-10' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,10,11);
Warnings:
Warning 1062 Duplicate entry '10-10-11' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(10,11,11);
Warnings:
Warning 1062 Duplicate entry '10-11-11' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
10 10 10

View File

@ -8,8 +8,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES('def','def','abc');
INSERT INTO t1 (c1,c2,c3) VALUES('def','abc','def');
INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def');
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES('abc','abc','abc');
Warnings:
Warning 1062 Duplicate entry 'abc-abc-abc' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES('abc','abc','def');
Warnings:
Warning 1062 Duplicate entry 'abc-abc-def' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES('abc','def','def');
Warnings:
Warning 1062 Duplicate entry 'abc-def-def' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
abc abc abc
@ -29,8 +35,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES('def','def','abc');
INSERT INTO t1 (c1,c2,c3) VALUES('def','abc','def');
INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def');
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES('abc','abc','abc');
Warnings:
Warning 1062 Duplicate entry 'abc-abc-abc' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES('abc','abc','def');
Warnings:
Warning 1062 Duplicate entry 'abc-abc-def' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES('abc','def','def');
Warnings:
Warning 1062 Duplicate entry 'abc-def-def' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
abc abc abc
@ -50,8 +62,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES('def','def','abc');
INSERT INTO t1 (c1,c2,c3) VALUES('def','abc','def');
INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def');
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES('abc','abc','abc');
Warnings:
Warning 1062 Duplicate entry 'abc-abc-abc' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES('abc','abc','def');
Warnings:
Warning 1062 Duplicate entry 'abc-abc-def' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES('abc','def','def');
Warnings:
Warning 1062 Duplicate entry 'abc-def-def' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
abc
@ -65,8 +83,14 @@ INSERT INTO t1 (c1,c2,c3) VALUES('def','def','abc');
INSERT INTO t1 (c1,c2,c3) VALUES('def','abc','def');
INSERT INTO t1 (c1,c2,c3) VALUES('abc','def','def');
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES('abc','abc','abc');
Warnings:
Warning 1062 Duplicate entry 'abc-abc-abc' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES('abc','abc','def');
Warnings:
Warning 1062 Duplicate entry 'abc-abc-def' for key 'c1'
INSERT IGNORE INTO t1 (c1,c2,c3) VALUES('abc','def','def');
Warnings:
Warning 1062 Duplicate entry 'abc-def-def' for key 'c1'
SELECT * FROM t1;
c1 c2 c3
abc abc abc

View File

@ -3,6 +3,8 @@ CREATE TABLE t1(c1 TINYINT NOT NULL PRIMARY KEY);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'PRIMARY'
SELECT * FROM t1;
c1
10
@ -12,6 +14,8 @@ CREATE TABLE t1(c1 SMALLINT NOT NULL PRIMARY KEY);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'PRIMARY'
SELECT * FROM t1;
c1
10
@ -21,6 +25,8 @@ CREATE TABLE t1(c1 MEDIUMINT NOT NULL PRIMARY KEY);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'PRIMARY'
SELECT * FROM t1;
c1
10
@ -30,6 +36,8 @@ CREATE TABLE t1(c1 INT NOT NULL PRIMARY KEY);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'PRIMARY'
SELECT * FROM t1;
c1
10
@ -39,6 +47,8 @@ CREATE TABLE t1(c1 INTEGER NOT NULL PRIMARY KEY);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'PRIMARY'
SELECT * FROM t1;
c1
10
@ -48,6 +58,8 @@ CREATE TABLE t1(c1 BIGINT NOT NULL PRIMARY KEY);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'PRIMARY'
SELECT * FROM t1;
c1
10
@ -57,6 +69,8 @@ CREATE TABLE t1(c1 DECIMAL NOT NULL PRIMARY KEY);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'PRIMARY'
SELECT * FROM t1;
c1
10
@ -66,6 +80,8 @@ CREATE TABLE t1(c1 DEC NOT NULL PRIMARY KEY);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'PRIMARY'
SELECT * FROM t1;
c1
10
@ -75,6 +91,8 @@ CREATE TABLE t1(c1 FIXED NOT NULL PRIMARY KEY);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'PRIMARY'
SELECT * FROM t1;
c1
10
@ -84,6 +102,8 @@ CREATE TABLE t1(c1 NUMERIC NOT NULL PRIMARY KEY);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'PRIMARY'
SELECT * FROM t1;
c1
10
@ -93,6 +113,8 @@ CREATE TABLE t1(c1 DOUBLE NOT NULL PRIMARY KEY);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'PRIMARY'
SELECT * FROM t1;
c1
10
@ -102,6 +124,8 @@ CREATE TABLE t1(c1 REAL NOT NULL PRIMARY KEY);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'PRIMARY'
SELECT * FROM t1;
c1
10
@ -111,6 +135,8 @@ CREATE TABLE t1(c1 DOUBLE PRECISION NOT NULL PRIMARY KEY);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'PRIMARY'
SELECT * FROM t1;
c1
10
@ -120,6 +146,8 @@ CREATE TABLE t1(c1 FLOAT NOT NULL PRIMARY KEY);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'PRIMARY'
SELECT * FROM t1;
c1
10

View File

@ -3,6 +3,8 @@ CREATE TABLE t1(c1 TINYINT NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'c1'
SELECT * FROM t1;
c1
10
@ -12,6 +14,8 @@ CREATE TABLE t1(c1 SMALLINT NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'c1'
SELECT * FROM t1;
c1
10
@ -21,6 +25,8 @@ CREATE TABLE t1(c1 MEDIUMINT NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'c1'
SELECT * FROM t1;
c1
10
@ -30,6 +36,8 @@ CREATE TABLE t1(c1 INT NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'c1'
SELECT * FROM t1;
c1
10
@ -39,6 +47,8 @@ CREATE TABLE t1(c1 INTEGER NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'c1'
SELECT * FROM t1;
c1
10
@ -48,6 +58,8 @@ CREATE TABLE t1(c1 BIGINT NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'c1'
SELECT * FROM t1;
c1
10
@ -57,6 +69,8 @@ CREATE TABLE t1(c1 DECIMAL NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'c1'
SELECT * FROM t1;
c1
10
@ -66,6 +80,8 @@ CREATE TABLE t1(c1 DEC NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'c1'
SELECT * FROM t1;
c1
10
@ -75,6 +91,8 @@ CREATE TABLE t1(c1 FIXED NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'c1'
SELECT * FROM t1;
c1
10
@ -84,6 +102,8 @@ CREATE TABLE t1(c1 NUMERIC NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'c1'
SELECT * FROM t1;
c1
10
@ -93,6 +113,8 @@ CREATE TABLE t1(c1 DOUBLE NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'c1'
SELECT * FROM t1;
c1
10
@ -102,6 +124,8 @@ CREATE TABLE t1(c1 REAL NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'c1'
SELECT * FROM t1;
c1
10
@ -111,6 +135,8 @@ CREATE TABLE t1(c1 DOUBLE PRECISION NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'c1'
SELECT * FROM t1;
c1
10
@ -120,6 +146,8 @@ CREATE TABLE t1(c1 FLOAT NULL UNIQUE);
INSERT INTO t1 (c1) VALUES(10);
INSERT INTO t1 (c1) VALUES(11);
INSERT IGNORE INTO t1 (c1) VALUES(10);
Warnings:
Warning 1062 Duplicate entry '10' for key 'c1'
SELECT * FROM t1;
c1
10

View File

@ -2,6 +2,8 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 TEXT);
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
TRUNCATE TABLE t1;
Warnings:
Warning 1062 Duplicate entry '3' for key 'PRIMARY'
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 abc

View File

@ -1,6 +1,8 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 TEXT);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_unique_error1.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
Warnings:
Warning 1062 Duplicate entry '3' for key 'PRIMARY'
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 abc
@ -10,6 +12,8 @@ c1 c2
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 TEXT);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_unique_error1.inc' IGNORE INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
Warnings:
Warning 1062 Duplicate entry '3' for key 'PRIMARY'
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 abc

View File

@ -4,6 +4,9 @@ INSERT INTO t1 VALUES(3,'a');
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
TRUNCATE TABLE t1;
INSERT INTO t1 VALUES(3,'a');
Warnings:
Warning 1062 Duplicate entry '3' for key 'PRIMARY'
Warning 1062 Duplicate entry '3' for key 'PRIMARY'
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 abc

View File

@ -2,6 +2,8 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 TEXT);
INSERT INTO t1 VALUES(3,'a');
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_unique_error2.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
Warnings:
Warning 1062 Duplicate entry '3' for key 'PRIMARY'
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 abc
@ -12,6 +14,8 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 TEXT);
INSERT INTO t1 VALUES(3,'a');
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_unique_error2.inc' IGNORE INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
Warnings:
Warning 1062 Duplicate entry '3' for key 'PRIMARY'
SELECT * FROM t1 ORDER BY c1;
c1 c2
1 abc

View File

@ -12,6 +12,10 @@ Tables_in_test
t1
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
TRUNCATE TABLE t1;
Warnings:
Warning 1062 Duplicate entry '1' for key 'PRIMARY'
Warning 1062 Duplicate entry '1' for key 'PRIMARY'
Warning 1062 Duplicate entry '0' for key 'PRIMARY'
SELECT * FROM t1 ORDER BY c1;
c1 c2
0 def

View File

@ -1,6 +1,10 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 TEXT);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_unique_error1.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (@c1,c2) SET c1 = @c1 % 2;
Warnings:
Warning 1062 Duplicate entry '1' for key 'PRIMARY'
Warning 1062 Duplicate entry '1' for key 'PRIMARY'
Warning 1062 Duplicate entry '0' for key 'PRIMARY'
SELECT * FROM t1 ORDER BY c1;
c1 c2
0 def
@ -8,6 +12,10 @@ c1 c2
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 TEXT);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_unique_error1.inc' IGNORE INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (@c1,c2) SET c1 = @c1 % 2;
Warnings:
Warning 1062 Duplicate entry '1' for key 'PRIMARY'
Warning 1062 Duplicate entry '1' for key 'PRIMARY'
Warning 1062 Duplicate entry '0' for key 'PRIMARY'
SELECT * FROM t1 ORDER BY c1;
c1 c2
0 def

View File

@ -2399,8 +2399,9 @@ INSERT INTO t3 VALUES(0,-128,1,2,3,4,5),(255,127,6,7,8,9,10);
INSERT INTO t4 VALUES(-128,0,1,2,3,4,5,5),(127,255,6,7,8,9,10,10);
INSERT INTO t5 VALUES(0,-128,1,2,3,4,5,5),(255,127,6,7,8,9,10,10);
INSERT INTO t4(c2,c3) VALUES(31,32) /* tries to increment out of range */;
ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t5(c2,c3) VALUES(33,34) /* tries to increment out of range */;
ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t4;
c1 c2 c3 c4 c5 c6 c7 c8
-101 102 103 104 105 106 107 108
@ -3760,20 +3761,12 @@ c1 c2 c3 c4 c5 c6 c7
0 124 27 28 29 30 31
SELECT * FROM t2 WHERE c1 = 256 ORDER BY c1,c6;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 = 256 ORDER BY c1,c6 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 = 256 ORDER BY c1,c6 DESC;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 = 256 ORDER BY c1,c6 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 <> 256 ORDER BY c1,c6;
c1 c2 c3 c4 c5 c6 c7
0 NULL 5 6 NULL 0 NULL
@ -5316,20 +5309,12 @@ c1 c2 c3 c4 c5 c6 c7
0 -128 26 27 28 29 30
SELECT * FROM t3 WHERE c2 = 128 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 128 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 128 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 128 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 <> 128 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -128 1 2 3 4 5
@ -8006,8 +7991,9 @@ INSERT INTO t3 VALUES(0,-32768,1,2,3,4,5),(255,-128,6,7,8,9,10),(65535,32767,11,
INSERT INTO t4 VALUES(-32768,0,1,2,3,4,5,5),(-128,255,6,7,8,9,10,10),(32767,65535,11,12,13,14,15,15);
INSERT INTO t5 VALUES(0,-32768,1,2,3,4,5,5),(255,-128,6,7,8,9,10,10),(65535,32767,11,12,13,14,15,15);
INSERT INTO t4(c2,c3) VALUES(31,32) /* tries to increment out of range */;
ERROR 23000: Duplicate entry '32767' for key 'PRIMARY'
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t5(c2,c3) VALUES(33,34) /* tries to increment out of range */;
ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t4;
c1 c2 c3 c4 c5 c6 c7 c8
-101 102 103 104 105 106 107 108
@ -9410,20 +9396,12 @@ c1 c2 c3 c4 c5 c6 c7
0 124 27 28 29 30 31
SELECT * FROM t2 WHERE c1 = 65536 ORDER BY c1,c6;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 = 65536 ORDER BY c1,c6 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 = 65536 ORDER BY c1,c6 DESC;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 = 65536 ORDER BY c1,c6 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 <> 65536 ORDER BY c1,c6;
c1 c2 c3 c4 c5 c6 c7
0 NULL 5 6 NULL 0 NULL
@ -11018,20 +10996,12 @@ c1 c2 c3 c4 c5 c6 c7
0 -32768 26 27 28 29 30
SELECT * FROM t3 WHERE c2 = 32768 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 32768 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 32768 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 32768 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 <> 32768 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -32768 1 2 3 4 5
@ -13718,8 +13688,9 @@ INSERT INTO t3 VALUES(0,-8388608,1,2,3,4,5),(255,-32768,6,7,8,9,10),(65535,-128,
INSERT INTO t4 VALUES(-8388608,0,1,2,3,4,5,5),(-32768,255,6,7,8,9,10,10),(-128,65535,11,12,13,14,15,15),(8388607,16777215,16,17,18,19,20,20);
INSERT INTO t5 VALUES(0,-8388608,1,2,3,4,5,5),(255,-32768,6,7,8,9,10,10),(65535,-128,11,12,13,14,15,15),(16777215,8388607,16,17,18,19,20,20);
INSERT INTO t4(c2,c3) VALUES(31,32) /* tries to increment out of range */;
ERROR 23000: Duplicate entry '8388607' for key 'PRIMARY'
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t5(c2,c3) VALUES(33,34) /* tries to increment out of range */;
ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t4;
c1 c2 c3 c4 c5 c6 c7 c8
-101 102 103 104 105 106 107 108
@ -15165,20 +15136,12 @@ c1 c2 c3 c4 c5 c6 c7
0 124 27 28 29 30 31
SELECT * FROM t2 WHERE c1 = 16777216 ORDER BY c1,c6;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 = 16777216 ORDER BY c1,c6 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 = 16777216 ORDER BY c1,c6 DESC;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 = 16777216 ORDER BY c1,c6 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 <> 16777216 ORDER BY c1,c6;
c1 c2 c3 c4 c5 c6 c7
0 NULL 5 6 NULL 0 NULL
@ -16825,20 +16788,12 @@ c1 c2 c3 c4 c5 c6 c7
0 -8388608 26 27 28 29 30
SELECT * FROM t3 WHERE c2 = 8388608 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 8388608 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 8388608 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 8388608 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 <> 8388608 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -8388608 1 2 3 4 5
@ -19535,8 +19490,9 @@ INSERT INTO t3 VALUES(0,-2147483648,1,2,3,4,5),(255,-8388608,6,7,8,9,10),(65535,
INSERT INTO t4 VALUES(-2147483648,0,1,2,3,4,5,5),(-8388608,255,6,7,8,9,10,10),(-32768,65535,11,12,13,14,15,15),(-128,16777215,16,17,18,19,20,20),(2147483647,4294967295,21,22,23,24,25,25);
INSERT INTO t5 VALUES(0,-2147483648,1,2,3,4,5,5),(255,-8388608,6,7,8,9,10,10),(65535,-32768,11,12,13,14,15,15),(16777215,-128,16,17,18,19,20,20),(4294967295,2147483647,21,22,23,24,25,25);
INSERT INTO t4(c2,c3) VALUES(31,32) /* tries to increment out of range */;
ERROR 23000: Duplicate entry '2147483647' for key 'PRIMARY'
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t5(c2,c3) VALUES(33,34) /* tries to increment out of range */;
ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t4;
c1 c2 c3 c4 c5 c6 c7 c8
-101 102 103 104 105 106 107 108
@ -21025,20 +20981,12 @@ c1 c2 c3 c4 c5 c6 c7
0 124 27 28 29 30 31
SELECT * FROM t2 WHERE c1 = 4294967296 ORDER BY c1,c6;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 = 4294967296 ORDER BY c1,c6 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 = 4294967296 ORDER BY c1,c6 DESC;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 = 4294967296 ORDER BY c1,c6 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 <> 4294967296 ORDER BY c1,c6;
c1 c2 c3 c4 c5 c6 c7
0 NULL 5 6 NULL 0 NULL
@ -22737,20 +22685,12 @@ c1 c2 c3 c4 c5 c6 c7
0 -2147483648 26 27 28 29 30
SELECT * FROM t3 WHERE c2 = 2147483648 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 2147483648 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 2147483648 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 2147483648 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 <> 2147483648 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -2147483648 1 2 3 4 5
@ -25457,8 +25397,9 @@ INSERT INTO t3 VALUES(0,-2147483648,1,2,3,4,5),(255,-8388608,6,7,8,9,10),(65535,
INSERT INTO t4 VALUES(-2147483648,0,1,2,3,4,5,5),(-8388608,255,6,7,8,9,10,10),(-32768,65535,11,12,13,14,15,15),(-128,16777215,16,17,18,19,20,20),(2147483647,4294967295,21,22,23,24,25,25);
INSERT INTO t5 VALUES(0,-2147483648,1,2,3,4,5,5),(255,-8388608,6,7,8,9,10,10),(65535,-32768,11,12,13,14,15,15),(16777215,-128,16,17,18,19,20,20),(4294967295,2147483647,21,22,23,24,25,25);
INSERT INTO t4(c2,c3) VALUES(31,32) /* tries to increment out of range */;
ERROR 23000: Duplicate entry '2147483647' for key 'PRIMARY'
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t5(c2,c3) VALUES(33,34) /* tries to increment out of range */;
ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t4;
c1 c2 c3 c4 c5 c6 c7 c8
-101 102 103 104 105 106 107 108
@ -26947,20 +26888,12 @@ c1 c2 c3 c4 c5 c6 c7
0 124 27 28 29 30 31
SELECT * FROM t2 WHERE c1 = 4294967296 ORDER BY c1,c6;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 = 4294967296 ORDER BY c1,c6 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 = 4294967296 ORDER BY c1,c6 DESC;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 = 4294967296 ORDER BY c1,c6 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
SELECT * FROM t2 WHERE c1 <> 4294967296 ORDER BY c1,c6;
c1 c2 c3 c4 c5 c6 c7
0 NULL 5 6 NULL 0 NULL
@ -28659,20 +28592,12 @@ c1 c2 c3 c4 c5 c6 c7
0 -2147483648 26 27 28 29 30
SELECT * FROM t3 WHERE c2 = 2147483648 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 2147483648 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 2147483648 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 2147483648 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 <> 2147483648 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -2147483648 1 2 3 4 5
@ -31379,7 +31304,7 @@ INSERT INTO t3 VALUES(0,-9223372036854775808,1,2,3,4,5),(255,-2147483648,6,7,8,9
INSERT INTO t4 VALUES(-9223372036854775808,0,1,2,3,4,5,5),(-2147483648,255,6,7,8,9,10,10),(-8388608,65535,11,12,13,14,15,15),(-32768,16777215,16,17,18,19,20,20),(-128,4294967295,21,22,23,24,25,25),(9223372036854775807,18446744073709551615,26,27,28,29,30,30);
INSERT INTO t5 VALUES(0,-9223372036854775808,1,2,3,4,5,5),(255,-2147483648,6,7,8,9,10,10),(65535,-8388608,11,12,13,14,15,15),(16777215,-32768,16,17,18,19,20,20),(4294967295,-128,21,22,23,24,25,25),(18446744073709551615,9223372036854775807,26,27,28,29,30,30);
INSERT INTO t4(c2,c3) VALUES(31,32) /* tries to increment out of range */;
ERROR 23000: Duplicate entry '9223372036854775807' for key 'PRIMARY'
ERROR 22003: Out of range value for column 'c1' at row 1
INSERT INTO t5(c2,c3) VALUES(33,34) /* tries to increment out of range */;
ERROR HY000: Failed to read auto-increment value from storage engine
SELECT * FROM t4;
@ -34577,20 +34502,12 @@ c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 31 32 33 34 35
SELECT * FROM t3 WHERE c2 = 9223372036854775808 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 9223372036854775808 ORDER BY c2,c7 LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 9223372036854775808 ORDER BY c2,c7 DESC;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 = 9223372036854775808 ORDER BY c2,c7 DESC LIMIT 2;
c1 c2 c3 c4 c5 c6 c7
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t3 WHERE c2 <> 9223372036854775808 ORDER BY c2,c7;
c1 c2 c3 c4 c5 c6 c7
0 -9223372036854775808 1 2 3 4 5

View File

@ -5072,8 +5072,12 @@ INSERT INTO t3(c1,c2) VALUES('34 9:23','34 9:23') /* throws error as row exists
ERROR 23000: Duplicate entry '825:23:00-825:23:00' for key 'idx'
INSERT IGNORE INTO t1(c1,c2) VALUES('10:22:33','10:22:34') /* doesn't throw error */;
INSERT IGNORE INTO t2(c1,c2) VALUES('12:34:56.78','12:34:56.78') /*doesn't throw error */;
Warnings:
Warning 1062 Duplicate entry '12:34:56-12:34:56' for key 'PRIMARY'
INSERT IGNORE INTO t1(c1,c2) VALUES('10:22:34','34 9:23') /*doesn't throw error */;
INSERT IGNORE INTO t3(c1,c2) VALUES('34 9:23','34 9:23') /*doesn't throw error */;
Warnings:
Warning 1062 Duplicate entry '825:23:00-825:23:00' for key 'idx'
SELECT * FROM t1 WHERE c1='10:23:33' /* no rows */;
c1 c2 c3
INSERT INTO t1(c1) VALUES('10:22:33') ON DUPLICATE KEY UPDATE c1='10:23:33';

View File

@ -3124,9 +3124,17 @@ ERROR 23000: Duplicate entry '2069' for key 'c2'
INSERT INTO t3(c1,c2) VALUES(00,00);
ERROR 23000: Duplicate entry '0000-0000' for key 'idx'
INSERT IGNORE INTO t1(c1,c2) VALUES(01,'99');
Warnings:
Warning 1062 Duplicate entry '2001' for key 'PRIMARY'
INSERT IGNORE INTO t2(c1,c2) VALUES('1999','1999');
Warnings:
Warning 1062 Duplicate entry '1999-1999' for key 'PRIMARY'
INSERT IGNORE INTO t1(c1,c2) VALUES('2098','69');
Warnings:
Warning 1062 Duplicate entry '2069' for key 'c2'
INSERT IGNORE INTO t3(c1,c2) VALUES(00,00);
Warnings:
Warning 1062 Duplicate entry '0000-0000' for key 'idx'
SELECT * FROM t1 WHERE c1='01' /* Returns 1 row */;
c1 c2 c3 c4
2001 2001 1998-12-28 1998-12-28 11:30:45
@ -6081,9 +6089,17 @@ ERROR 23000: Duplicate entry '69' for key 'c2'
INSERT INTO t3(c1,c2) VALUES(00,00);
ERROR 23000: Duplicate entry '00-00' for key 'idx'
INSERT IGNORE INTO t1(c1,c2) VALUES(01,'99');
Warnings:
Warning 1062 Duplicate entry '01' for key 'PRIMARY'
INSERT IGNORE INTO t2(c1,c2) VALUES('1999','1999');
Warnings:
Warning 1062 Duplicate entry '99-99' for key 'PRIMARY'
INSERT IGNORE INTO t1(c1,c2) VALUES('2098','69');
Warnings:
Warning 1062 Duplicate entry '69' for key 'c2'
INSERT IGNORE INTO t3(c1,c2) VALUES(00,00);
Warnings:
Warning 1062 Duplicate entry '00-00' for key 'idx'
SELECT * FROM t1 WHERE c1='01' /* Returns 1 row */;
c1 c2 c3 c4
01 01 1998-12-28 1998-12-28 11:30:45

File diff suppressed because it is too large Load Diff

View File

@ -56,8 +56,6 @@ Warning 1264 Out of range value for column 'c2' at row 3
SELECT COUNT(*) FROM t1 WHERE c1=4294967296 AND c2=2147483648 /* no rows */;
COUNT(*)
0
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t1 WHERE c1=4294967295 AND c2=2147483647;
c1 c2 c3
4294967295 2147483647 10
@ -1152,8 +1150,6 @@ Warning 1264 Out of range value for column 'c2' at row 3
SELECT COUNT(*) FROM t1 WHERE c1=256 AND c2=128 /* no rows */;
COUNT(*)
0
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t1 WHERE c1=255 AND c2=127;
c1 c2 c3
255 127 10
@ -1926,8 +1922,6 @@ Warning 1264 Out of range value for column 'c2' at row 3
SELECT COUNT(*) FROM t1 WHERE c1=65536 AND c2=32768 /* no rows */;
COUNT(*)
0
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t1 WHERE c1=65535 AND c2=32767;
c1 c2 c3
65535 32767 10
@ -2675,8 +2669,6 @@ Warning 1264 Out of range value for column 'c2' at row 3
SELECT COUNT(*) FROM t1 WHERE c1=16777216 AND c2=8388608 /* no rows */;
COUNT(*)
0
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t1 WHERE c1=16777215 AND c2=8388607;
c1 c2 c3
16777215 8388607 10
@ -3424,8 +3416,6 @@ Warning 1264 Out of range value for column 'c2' at row 3
SELECT COUNT(*) FROM t1 WHERE c1=18446744073709551616 AND c2=9223372036854775808 /* no rows */;
COUNT(*)
0
Warnings:
Warning 1264 Out of range value for column 'c2' at row 1
SELECT * FROM t1 WHERE c1=18446744073709551615 AND c2=9223372036854775807;
c1 c2 c3
18446744073709551615 9223372036854775807 10

View File

@ -761,11 +761,10 @@ INSERT INTO t2 VALUES(0,-128,1,2,3,4,5),(255,127,6,7,8,9,10);
INSERT INTO t3 VALUES(0,-128,1,2,3,4,5),(255,127,6,7,8,9,10);
INSERT INTO t4 VALUES(-128,0,1,2,3,4,5,5),(127,255,6,7,8,9,10,10);
INSERT INTO t5 VALUES(0,-128,1,2,3,4,5,5),(255,127,6,7,8,9,10,10);
--error ER_DUP_ENTRY
--error 167
INSERT INTO t4(c2,c3) VALUES(31,32) /* tries to increment out of range */;
--disable_warnings
--error 167
INSERT INTO t5(c2,c3) VALUES(33,34) /* tries to increment out of range */;
--enable_warnings
--sorted_result
SELECT * FROM t4;
@ -2120,11 +2119,10 @@ INSERT INTO t2 VALUES(0,-32768,1,2,3,4,5),(255,-128,6,7,8,9,10),(65535,32767,11,
INSERT INTO t3 VALUES(0,-32768,1,2,3,4,5),(255,-128,6,7,8,9,10),(65535,32767,11,12,13,14,15);
INSERT INTO t4 VALUES(-32768,0,1,2,3,4,5,5),(-128,255,6,7,8,9,10,10),(32767,65535,11,12,13,14,15,15);
INSERT INTO t5 VALUES(0,-32768,1,2,3,4,5,5),(255,-128,6,7,8,9,10,10),(65535,32767,11,12,13,14,15,15);
--error ER_DUP_ENTRY
--error 167
INSERT INTO t4(c2,c3) VALUES(31,32) /* tries to increment out of range */;
--disable_warnings
--error 167
INSERT INTO t5(c2,c3) VALUES(33,34) /* tries to increment out of range */;
--enable_warnings
--sorted_result
SELECT * FROM t4;
@ -3479,11 +3477,10 @@ INSERT INTO t2 VALUES(0,-8388608,1,2,3,4,5),(255,-32768,6,7,8,9,10),(65535,-128,
INSERT INTO t3 VALUES(0,-8388608,1,2,3,4,5),(255,-32768,6,7,8,9,10),(65535,-128,11,12,13,14,15),(16777215,8388607,16,17,18,19,20);
INSERT INTO t4 VALUES(-8388608,0,1,2,3,4,5,5),(-32768,255,6,7,8,9,10,10),(-128,65535,11,12,13,14,15,15),(8388607,16777215,16,17,18,19,20,20);
INSERT INTO t5 VALUES(0,-8388608,1,2,3,4,5,5),(255,-32768,6,7,8,9,10,10),(65535,-128,11,12,13,14,15,15),(16777215,8388607,16,17,18,19,20,20);
--error ER_DUP_ENTRY
--error 167
INSERT INTO t4(c2,c3) VALUES(31,32) /* tries to increment out of range */;
--disable_warnings
--error 167
INSERT INTO t5(c2,c3) VALUES(33,34) /* tries to increment out of range */;
--enable_warnings
--sorted_result
SELECT * FROM t4;
@ -4838,11 +4835,10 @@ INSERT INTO t2 VALUES(0,-2147483648,1,2,3,4,5),(255,-8388608,6,7,8,9,10),(65535,
INSERT INTO t3 VALUES(0,-2147483648,1,2,3,4,5),(255,-8388608,6,7,8,9,10),(65535,-32768,11,12,13,14,15),(16777215,-128,16,17,18,19,20),(4294967295,2147483647,21,22,23,24,25);
INSERT INTO t4 VALUES(-2147483648,0,1,2,3,4,5,5),(-8388608,255,6,7,8,9,10,10),(-32768,65535,11,12,13,14,15,15),(-128,16777215,16,17,18,19,20,20),(2147483647,4294967295,21,22,23,24,25,25);
INSERT INTO t5 VALUES(0,-2147483648,1,2,3,4,5,5),(255,-8388608,6,7,8,9,10,10),(65535,-32768,11,12,13,14,15,15),(16777215,-128,16,17,18,19,20,20),(4294967295,2147483647,21,22,23,24,25,25);
--error ER_DUP_ENTRY
--error 167
INSERT INTO t4(c2,c3) VALUES(31,32) /* tries to increment out of range */;
--disable_warnings
--error 167
INSERT INTO t5(c2,c3) VALUES(33,34) /* tries to increment out of range */;
--enable_warnings
--sorted_result
SELECT * FROM t4;
@ -6197,11 +6193,10 @@ INSERT INTO t2 VALUES(0,-2147483648,1,2,3,4,5),(255,-8388608,6,7,8,9,10),(65535,
INSERT INTO t3 VALUES(0,-2147483648,1,2,3,4,5),(255,-8388608,6,7,8,9,10),(65535,-32768,11,12,13,14,15),(16777215,-128,16,17,18,19,20),(4294967295,2147483647,21,22,23,24,25);
INSERT INTO t4 VALUES(-2147483648,0,1,2,3,4,5,5),(-8388608,255,6,7,8,9,10,10),(-32768,65535,11,12,13,14,15,15),(-128,16777215,16,17,18,19,20,20),(2147483647,4294967295,21,22,23,24,25,25);
INSERT INTO t5 VALUES(0,-2147483648,1,2,3,4,5,5),(255,-8388608,6,7,8,9,10,10),(65535,-32768,11,12,13,14,15,15),(16777215,-128,16,17,18,19,20,20),(4294967295,2147483647,21,22,23,24,25,25);
--error ER_DUP_ENTRY
--error 167
INSERT INTO t4(c2,c3) VALUES(31,32) /* tries to increment out of range */;
--disable_warnings
--error 167
INSERT INTO t5(c2,c3) VALUES(33,34) /* tries to increment out of range */;
--enable_warnings
--sorted_result
SELECT * FROM t4;
@ -7555,7 +7550,7 @@ INSERT INTO t2 VALUES(0,-9223372036854775808,1,2,3,4,5),(255,-2147483648,6,7,8,9
INSERT INTO t3 VALUES(0,-9223372036854775808,1,2,3,4,5),(255,-2147483648,6,7,8,9,10),(65535,-8388608,11,12,13,14,15),(16777215,-32768,16,17,18,19,20),(4294967295,-128,21,22,23,24,25),(18446744073709551615,9223372036854775807,26,27,28,29,30);
INSERT INTO t4 VALUES(-9223372036854775808,0,1,2,3,4,5,5),(-2147483648,255,6,7,8,9,10,10),(-8388608,65535,11,12,13,14,15,15),(-32768,16777215,16,17,18,19,20,20),(-128,4294967295,21,22,23,24,25,25),(9223372036854775807,18446744073709551615,26,27,28,29,30,30);
INSERT INTO t5 VALUES(0,-9223372036854775808,1,2,3,4,5,5),(255,-2147483648,6,7,8,9,10,10),(65535,-8388608,11,12,13,14,15,15),(16777215,-32768,16,17,18,19,20,20),(4294967295,-128,21,22,23,24,25,25),(18446744073709551615,9223372036854775807,26,27,28,29,30,30);
--error ER_DUP_ENTRY
--error 167
INSERT INTO t4(c2,c3) VALUES(31,32) /* tries to increment out of range */;
--error ER_AUTOINC_READ_FAILED
INSERT INTO t5(c2,c3) VALUES(33,34) /* tries to increment out of range */;

View File

@ -44,12 +44,10 @@ SET auto_increment_increment = 500;
SET auto_increment_offset = 300;
CREATE TABLE t1 (a TINYINT <CUSTOM_COL_OPTIONS> AUTO_INCREMENT, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
INSERT INTO t1 (a) VALUES (NULL);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
ERROR 22003: Out of range value for column 'a' at row 1
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
127
850
SELECT * FROM t1;
a
127
DROP TABLE t1;

View File

@ -739,6 +739,8 @@ y YEAR <CUSTOM_COL_OPTIONS> NOT NULL,
y4 YEAR(4) <CUSTOM_COL_OPTIONS> NOT NULL,
y2 YEAR(2) <CUSTOM_COL_OPTIONS> NOT NULL
) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
d date # # #
@ -913,6 +915,8 @@ COUNT(c) COUNT(c2)
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c YEAR(2) <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
c year(2) NO NULL
@ -922,6 +926,9 @@ DROP TABLE t1;
CREATE TABLE t1 (c YEAR(2) <CUSTOM_COL_OPTIONS> NOT NULL,
c2 YEAR(2) <CUSTOM_COL_OPTIONS> NOT NULL DEFAULT '12'
) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
c year(2) NO NULL

View File

@ -723,6 +723,8 @@ y YEAR <CUSTOM_COL_OPTIONS> NULL,
y4 YEAR(4) <CUSTOM_COL_OPTIONS> NULL,
y2 YEAR(2) <CUSTOM_COL_OPTIONS> NULL
) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
d date # # #
@ -884,6 +886,8 @@ COUNT(c2) COUNT(c1) COUNT(c) COUNT(*)
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c YEAR(2) <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
c year(2) YES NULL
@ -896,6 +900,10 @@ CREATE TABLE t1 (c YEAR(2) <CUSTOM_COL_OPTIONS> NULL,
c1 YEAR(2) <CUSTOM_COL_OPTIONS> NULL DEFAULT NULL,
c2 YEAR(2) <CUSTOM_COL_OPTIONS> NULL DEFAULT '12'
) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
c year(2) YES NULL

View File

@ -47,6 +47,8 @@ a b
5 e
6 f
INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
Warnings:
Warning 1062 Duplicate entry '1' for key 'a'
INSERT INTO t1 (a,b) VALUES (3,'a'),(4,'d') ON DUPLICATE KEY UPDATE a = a+10;
SELECT * FROM t1;
a b
@ -85,6 +87,8 @@ a b
5 e
6 f
INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
Warnings:
Warning 1062 Duplicate entry '1-a' for key 'a'
INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z') ON DUPLICATE KEY UPDATE a = a+VALUES(a);
SELECT * FROM t1;
a b
@ -131,6 +135,8 @@ a b
5 e
6 f
INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
Warnings:
Warning 1062 Duplicate entry '1' for key 'PRIMARY'
INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z') ON DUPLICATE KEY UPDATE b = CONCAT(b,b);
SELECT * FROM t1;
a b

View File

@ -7,6 +7,8 @@ y YEAR <CUSTOM_COL_OPTIONS>,
y4 YEAR(4) <CUSTOM_COL_OPTIONS>,
y2 YEAR(2) <CUSTOM_COL_OPTIONS>
) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
d date # # #

View File

@ -1996,4 +1996,28 @@ create table if not exists t1 (a int unique, b int)
ignore select 1 as a, 1 as b union select 1 as a, 2 as b;
select * from t1;
drop table t1;
--echo #
--echo # Checking that CREATE IF NOT EXISTS is not blocked by running SELECT
--echo #
create table t1 (a int, b int) engine=myisam;
create table t2 (a int, b int) engine=myisam;
insert into t1 values (1,1);
lock tables t1 read;
connect (user1,localhost,root,,test);
set @@lock_wait_timeout=5;
create table if not exists t1 (a int, b int);
create table if not exists t1 (a int, b int) select 2,2;
create table if not exists t1 like t2;
--error ER_TABLE_EXISTS_ERROR
create table t1 (a int, b int);
--error ER_TABLE_EXISTS_ERROR
create table t1 (a int, b int) select 2,2;
--error ER_TABLE_EXISTS_ERROR
create table t1 like t2;
disconnect user1;
connection default;
select * from t1;
unlock tables;
drop table t1,t2;

View File

@ -1789,6 +1789,24 @@ disconnect con12828477_1;
disconnect con12828477_2;
disconnect con12828477_3;
--echo #
--echo # MDEV-3818: Query against view over IS tables worse than equivalent query without view
--echo #
create view v1 as select table_schema, table_name, column_name from information_schema.columns;
explain extended
select column_name from v1
where (table_schema = "osm") and (table_name = "test");
explain extended
select information_schema.columns.column_name as column_name
from information_schema.columns
where (information_schema.columns.table_schema = 'osm') and (information_schema.columns.table_name = 'test');
drop view v1;
--echo #
--echo # Clean-up.
drop database mysqltest;

View File

@ -1777,5 +1777,42 @@ drop table t1, t2;
set optimizer_switch=@subselect4_tmp;
--echo #
--echo # MDEV-3899 Valgrind warnings (blocks are definitely lost) in filesort on IN subquery with SUM and DISTINCT
--echo #
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(9);
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (8);
SELECT * FROM t1
WHERE (1, 1) IN (SELECT a, SUM(DISTINCT a) FROM t1, t2 GROUP BY a);
drop table t1, t2;
--echo #
--echo # MDEV-3902 Assertion `record_length == m_record_length' failed at Filesort_buffer::alloc_sort_buffer
--echo #
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (pk INT PRIMARY KEY, b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,1),(2,7);
CREATE TABLE t3 (c INT) ENGINE=MyISAM;
INSERT INTO t3 VALUES (8);
SELECT * FROM t1
WHERE (1, 5) IN (SELECT b, SUM(DISTINCT b) FROM t2, t3 GROUP BY b);
SELECT * FROM t2 AS alias1, t2 AS alias2
WHERE EXISTS ( SELECT 1 ) AND (alias2.pk = alias1.b )
ORDER BY alias1.b;
drop table t1, t2, t3;
SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size;

View File

@ -118,10 +118,10 @@ Usage: $script [host [user [db]]] OPTIONS
--rollback undo the last changes to the grant-tables.
Note:
+ At least the user and the db must be given (even with wildcards)
+ If no host is given, `localhost' is assumed
+ Wilcards (*,?,%,_) are allowed for host, user and db, but be sure
to escape them from your shell!! (ie type \\* or '*')
At least the user and the db must be given (even with wildcards)
If no host is given, `localhost' is assumed
Wilcards (*,?,%,_) are allowed for host, user and db, but be sure
to escape them from your shell!! (ie type \\* or '*')
_OPTIONS
$RELEASE = <<'_RELEASE';

View File

@ -2453,21 +2453,6 @@ void dec_connection_count(THD *thd)
}
/*
Delete the THD object and decrease number of threads
SYNOPSIS
delete_thd()
thd Thread handler
*/
void delete_thd(THD *thd)
{
thread_count--;
delete thd;
}
/*
Unlink thd from global list of available connections and free thd
@ -2486,14 +2471,23 @@ void unlink_thd(THD *thd)
thd_cleanup(thd);
dec_connection_count(thd);
mysql_mutex_lock(&LOCK_status);
add_to_status(&global_status_var, &thd->status_var);
mysql_mutex_unlock(&LOCK_status);
mysql_mutex_lock(&LOCK_thread_count);
thread_count--;
thd->unlink();
/*
Used by binlog_reset_master. It would be cleaner to use
DEBUG_SYNC here, but that's not possible because the THD's debug
sync feature has been shut down at this point.
*/
DBUG_EXECUTE_IF("sleep_after_lock_thread_count_before_delete_thd", sleep(5););
delete_thd(thd);
mysql_mutex_unlock(&LOCK_thread_count);
delete thd;
DBUG_VOID_RETURN;
}
@ -2602,10 +2596,13 @@ bool one_thread_per_connection_end(THD *thd, bool put_in_cache)
/* Mark that current_thd is not valid anymore */
my_pthread_setspecific_ptr(THR_THD, 0);
if (put_in_cache)
{
mysql_mutex_lock(&LOCK_thread_count);
put_in_cache= cache_thread();
mysql_mutex_unlock(&LOCK_thread_count);
if (put_in_cache)
DBUG_RETURN(0); // Thread is reused
mysql_mutex_unlock(&LOCK_thread_count);
if (put_in_cache)
DBUG_RETURN(0); // Thread is reused
}
/* It's safe to broadcast outside a lock (COND... is not deleted here) */
DBUG_PRINT("signal", ("Broadcasting COND_thread_count"));

View File

@ -35,7 +35,6 @@
static bool no_threads_end(THD *thd, bool put_in_cache)
{
unlink_thd(thd);
mysql_mutex_unlock(&LOCK_thread_count);
return 1; // Abort handle_one_connection
}

View File

@ -2406,10 +2406,11 @@ void drop_open_table(THD *thd, TABLE *table, const char *db_name,
Check that table exists in table definition cache, on disk
or in some storage engine.
@param thd Thread context
@param table Table list element
@param[out] exists Out parameter which is set to TRUE if table
exists and to FALSE otherwise.
@param thd Thread context
@param table Table list element
@param fast_check Check only if share or .frm file exists
@param[out] exists Out parameter which is set to TRUE if table
exists and to FALSE otherwise.
@note This function acquires LOCK_open internally.
@ -2421,7 +2422,8 @@ void drop_open_table(THD *thd, TABLE *table, const char *db_name,
@retval FALSE No error. 'exists' out parameter set accordingly.
*/
bool check_if_table_exists(THD *thd, TABLE_LIST *table, bool *exists)
bool check_if_table_exists(THD *thd, TABLE_LIST *table, bool fast_check,
bool *exists)
{
char path[FN_REFLEN + 1];
TABLE_SHARE *share;
@ -2429,7 +2431,8 @@ bool check_if_table_exists(THD *thd, TABLE_LIST *table, bool *exists)
*exists= TRUE;
DBUG_ASSERT(thd->mdl_context.
DBUG_ASSERT(fast_check ||
thd->mdl_context.
is_lock_owner(MDL_key::TABLE, table->db,
table->table_name, MDL_SHARED));
@ -2446,6 +2449,12 @@ bool check_if_table_exists(THD *thd, TABLE_LIST *table, bool *exists)
if (!access(path, F_OK))
goto end;
if (fast_check)
{
*exists= FALSE;
goto end;
}
/* .FRM file doesn't exist. Check if some engine can provide it. */
if (ha_check_if_table_exists(thd, table->db, table->table_name, exists))
{
@ -2995,7 +3004,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
{
bool exists;
if (check_if_table_exists(thd, table_list, &exists))
if (check_if_table_exists(thd, table_list, 0, &exists))
DBUG_RETURN(TRUE);
if (!exists)
@ -3148,16 +3157,6 @@ retry_share:
while (table_cache_count > table_cache_size && unused_tables)
free_cache_entry(unused_tables);
if (get_use_stat_tables_mode(thd) > NEVER)
{
if (share->table_category != TABLE_CATEGORY_SYSTEM)
{
if (!share->stats_can_be_read &&
!alloc_statistics_for_table_share(thd, share, TRUE))
share->stats_can_be_read= TRUE;
}
}
mysql_mutex_unlock(&LOCK_open);
/* make a new table */
@ -4643,22 +4642,24 @@ open_and_process_table(THD *thd, LEX *lex, TABLE_LIST *tables,
if (get_use_stat_tables_mode(thd) > NEVER && tables->table)
{
TABLE_SHARE *table_share= tables->table->s;
if (table_share && table_share->table_category != TABLE_CATEGORY_SYSTEM)
if (table_share && table_share->table_category == TABLE_CATEGORY_USER &&
table_share->tmp_table == NO_TMP_TABLE)
{
if (!table_share->stats_can_be_read &&
!alloc_statistics_for_table_share(thd, table_share, FALSE))
{
KEY *key_info= table_share->key_info;
KEY *key_info_end= key_info + table_share->keys;
KEY *table_key_info= tables->table->key_info;
for ( ; key_info < key_info_end; key_info++, table_key_info++)
table_key_info->read_stats= key_info->read_stats;
Field **field_ptr= table_share->field;
Field **table_field_ptr= tables->table->field;
for ( ; *field_ptr; field_ptr++, table_field_ptr++)
(*table_field_ptr)->read_stats= (*field_ptr)->read_stats;
table_share->stats_can_be_read= TRUE;
if (table_share->stats_cb.stats_can_be_read ||
!alloc_statistics_for_table_share(thd, table_share, FALSE))
{
if (table_share->stats_cb.stats_can_be_read)
{
KEY *key_info= table_share->key_info;
KEY *key_info_end= key_info + table_share->keys;
KEY *table_key_info= tables->table->key_info;
for ( ; key_info < key_info_end; key_info++, table_key_info++)
table_key_info->read_stats= key_info->read_stats;
Field **field_ptr= table_share->field;
Field **table_field_ptr= tables->table->field;
for ( ; *field_ptr; field_ptr++, table_field_ptr++)
(*table_field_ptr)->read_stats= (*field_ptr)->read_stats;
}
}
}
}
@ -4711,7 +4712,18 @@ extern "C" uchar *schema_set_get_key(const uchar *record, size_t *length,
open, see open_table() description for details.
@retval FALSE Success.
@retval TRUE Failure (e.g. connection was killed)
@retval TRUE Failure (e.g. connection was killed) or table existed
for a CREATE TABLE.
@notes
In case of CREATE TABLE we avoid a wait for tables that are in use
by first trying to do a meta data lock with timeout == 0. If we get a
timeout we will check if table exists (it should) and retry with
normal timeout if it didn't exists.
Note that for CREATE TABLE IF EXISTS we only generate a warning
but still return TRUE (to abort the calling open_table() function).
On must check THD->is_error() if one wants to distinguish between warning
and error.
*/
bool
@ -4723,6 +4735,10 @@ lock_table_names(THD *thd,
TABLE_LIST *table;
MDL_request global_request;
Hash_set<TABLE_LIST, schema_set_get_key> schema_set;
ulong org_lock_wait_timeout= lock_wait_timeout;
/* Check if we are using CREATE TABLE ... IF NOT EXISTS */
bool create_table;
Dummy_error_handler error_handler;
DBUG_ENTER("lock_table_names");
DBUG_ASSERT(!thd->locked_tables_mode);
@ -4744,8 +4760,14 @@ lock_table_names(THD *thd,
}
}
if (! (flags & MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK) &&
! mdl_requests.is_empty())
if (mdl_requests.is_empty())
DBUG_RETURN(FALSE);
/* Check if CREATE TABLE IF NOT EXISTS was used */
create_table= (tables_start && tables_start->open_strategy ==
TABLE_LIST::OPEN_IF_EXISTS);
if (!(flags & MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK))
{
/*
Scoped locks: Take intention exclusive locks on all involved
@ -4773,12 +4795,58 @@ lock_table_names(THD *thd,
global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
MDL_STATEMENT);
mdl_requests.push_front(&global_request);
if (create_table)
lock_wait_timeout= 0; // Don't wait for timeout
}
if (thd->mdl_context.acquire_locks(&mdl_requests, lock_wait_timeout))
DBUG_RETURN(TRUE);
for (;;)
{
bool exists= TRUE;
bool res;
DBUG_RETURN(FALSE);
if (create_table)
thd->push_internal_handler(&error_handler); // Avoid warnings & errors
res= thd->mdl_context.acquire_locks(&mdl_requests, lock_wait_timeout);
if (create_table)
thd->pop_internal_handler();
if (!res)
DBUG_RETURN(FALSE); // Got locks
if (!create_table)
DBUG_RETURN(TRUE); // Return original error
/*
We come here in the case of lock timeout when executing
CREATE TABLE IF NOT EXISTS.
Verify that table really exists (it should as we got a lock conflict)
*/
if (check_if_table_exists(thd, tables_start, 1, &exists))
DBUG_RETURN(TRUE); // Should never happen
if (exists)
{
if (thd->lex->create_info.options & HA_LEX_CREATE_IF_NOT_EXISTS)
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
tables_start->table_name);
}
else
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), tables_start->table_name);
DBUG_RETURN(TRUE);
}
/* purecov: begin inspected */
/*
We got error from acquire_locks but table didn't exists.
In theory this should never happen, except maybe in
CREATE or DROP DATABASE scenario.
We play safe and restart the original acquire_locks with the
original timeout
*/
create_table= 0;
lock_wait_timeout= org_lock_wait_timeout;
/* purecov: end */
}
}
@ -4900,7 +4968,7 @@ bool open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags,
}
/*
Initialize temporary MEM_ROOT for new .FRM parsing. Do not allocate
Initialize temporary MEM_ROOT for new .FRM parsing. Do not alloctaate
anything yet, to avoid penalty for statements which don't use views
and thus new .FRM format.
*/

View File

@ -302,7 +302,8 @@ TABLE *find_table_for_mdl_upgrade(THD *thd, const char *db,
const char *table_name,
bool no_error);
void mark_tmp_table_for_reuse(TABLE *table);
bool check_if_table_exists(THD *thd, TABLE_LIST *table, bool *exists);
bool check_if_table_exists(THD *thd, TABLE_LIST *table, bool fast_check,
bool *exists);
int update_virtual_fields(THD *thd, TABLE *table,
enum enum_vcol_update_mode vcol_update_mode= VCOL_UPDATE_FOR_READ);
int dynamic_column_error_message(enum_dyncol_func_result rc);

View File

@ -1439,7 +1439,6 @@ THD::~THD()
mysql_mutex_lock(&LOCK_thd_data);
mysys_var=0; // Safety (shouldn't be needed)
mysql_mutex_unlock(&LOCK_thd_data);
add_to_status(&global_status_var, &status_var);
/* Close connection */
#ifndef EMBEDDED_LIBRARY

View File

@ -939,7 +939,7 @@ update_binlog:
char quoted_name[FN_REFLEN+3];
// Only write drop table to the binlog for tables that no longer exist.
if (check_if_table_exists(thd, tbl, &exists))
if (check_if_table_exists(thd, tbl, 0, &exists))
{
error= true;
goto exit;

View File

@ -2612,7 +2612,14 @@ case SQLCOM_PREPARE:
goto end_with_restore_list;
}
if (!(res= open_and_lock_tables(thd, lex->query_tables, TRUE, 0)))
res= open_and_lock_tables(thd, lex->query_tables, TRUE, 0);
if (res)
{
/* Got error or warning. Set res to 1 if error */
if (!(res= thd->is_error()))
my_ok(thd); // CREATE ... IF NOT EXISTS
}
else
{
/* The table already exists */
if (create_table->table)

View File

@ -7473,10 +7473,10 @@ JOIN_TAB *next_breadth_first_tab(JOIN *join, enum enum_exec_or_opt tabs_kind,
}
JOIN_TAB *first_top_level_tab(JOIN *join, enum enum_with_const_tables with_const)
JOIN_TAB *first_top_level_tab(JOIN *join, enum enum_with_const_tables const_tbls)
{
JOIN_TAB *tab= join->join_tab;
if (with_const == WITH_CONST_TABLES)
if (const_tbls == WITHOUT_CONST_TABLES)
{
if (join->const_tables == join->table_count)
return NULL;

View File

@ -3389,13 +3389,13 @@ bool get_lookup_value(THD *thd, Item_func *item_func,
Item_field *item_field;
CHARSET_INFO *cs= system_charset_info;
if (item_func->arguments()[0]->type() == Item::FIELD_ITEM &&
if (item_func->arguments()[0]->real_item()->type() == Item::FIELD_ITEM &&
item_func->arguments()[1]->const_item())
{
idx_field= 0;
idx_val= 1;
}
else if (item_func->arguments()[1]->type() == Item::FIELD_ITEM &&
else if (item_func->arguments()[1]->real_item()->type() == Item::FIELD_ITEM &&
item_func->arguments()[0]->const_item())
{
idx_field= 1;
@ -3404,7 +3404,7 @@ bool get_lookup_value(THD *thd, Item_func *item_func,
else
return 0;
item_field= (Item_field*) item_func->arguments()[idx_field];
item_field= (Item_field*) item_func->arguments()[idx_field]->real_item();
if (table->table != item_field->field->table)
return 0;
tmp_str= item_func->arguments()[idx_val]->val_str(&str_buff);

View File

@ -158,34 +158,6 @@ inline int open_single_stat_table(THD *thd, TABLE_LIST *table,
}
/**
@details
If the value of the parameter is_safe is TRUE then the function
just copies the address pointed by the parameter src into the memory
pointed by the parameter dest. Otherwise the function performs the
following statement as an atomic action:
if (*dest == NULL) { *dest= *src; }
i.e. the same copying is performed only if *dest is NULL.
*/
static
inline void store_address_if_first(void **dest, void **src, bool is_safe)
{
if (is_safe)
{
if (!*dest)
memcpy(dest, src, sizeof(void *));
}
else
{
char *null= NULL;
my_atomic_rwlock_wrlock(&statistics_lock);
my_atomic_casptr(dest, (void **) &null, *src)
my_atomic_rwlock_wrunlock(&statistics_lock);
}
}
/*
The class Column_statistics_collected is a helper class used to collect
statistics on a table column. The class is derived directly from
@ -737,15 +709,16 @@ public:
void get_stat_values()
{
table_share->read_stats->cardinality_is_null= TRUE;
table_share->read_stats->cardinality= 0;
Table_statistics *read_stats= table_share->stats_cb.table_stats;
read_stats->cardinality_is_null= TRUE;
read_stats->cardinality= 0;
if (find_stat())
{
Field *stat_field= stat_table->field[TABLE_STAT_CARDINALITY];
if (!stat_field->is_null())
{
table_share->read_stats->cardinality_is_null= FALSE;
table_share->read_stats->cardinality= stat_field->val_int();
read_stats->cardinality_is_null= FALSE;
read_stats->cardinality= stat_field->val_int();
}
}
}
@ -1547,28 +1520,22 @@ public:
*/
static
void create_min_max_stistical_fields_for_table(TABLE *table)
void create_min_max_statistical_fields_for_table(TABLE *table)
{
Field *table_field;
Field **field_ptr;
uchar *record;
uint rec_buff_length= table->s->rec_buff_length;
for (field_ptr= table->field; *field_ptr; field_ptr++)
if ((table->collected_stats->min_max_record_buffers=
(uchar *) alloc_root(&table->mem_root, 2*rec_buff_length)))
{
table_field= *field_ptr;
table_field->collected_stats->max_value=
table_field->collected_stats->min_value= NULL;
}
uchar *record= table->collected_stats->min_max_record_buffers;
memset(record, 0, 2*rec_buff_length);
if ((record= (uchar *) alloc_root(&table->mem_root, 2*rec_buff_length)))
{
for (uint i=0; i < 2; i++, record+= rec_buff_length)
{
for (field_ptr= table->field; *field_ptr; field_ptr++)
for (Field **field_ptr= table->field; *field_ptr; field_ptr++)
{
Field *fld;
table_field= *field_ptr;
Field *table_field= *field_ptr;
my_ptrdiff_t diff= record-table->record[0];
if (!bitmap_is_set(table->read_set, table_field->field_index))
continue;
@ -1615,41 +1582,40 @@ void create_min_max_stistical_fields_for_table(TABLE *table)
*/
static
void create_min_max_stistical_fields_for_table_share(THD *thd,
TABLE_SHARE *table_share,
bool is_safe)
void create_min_max_statistical_fields_for_table_share(THD *thd,
TABLE_SHARE *table_share)
{
Field *table_field;
Field **field_ptr;
uchar *record;
TABLE_STATISTICS_CB *stats_cb= &table_share->stats_cb;
Table_statistics *stats= stats_cb->table_stats;
if (stats->min_max_record_buffers)
return;
uint rec_buff_length= table_share->rec_buff_length;
for (field_ptr= table_share->field; *field_ptr; field_ptr++)
if ((stats->min_max_record_buffers=
(uchar *) alloc_root(&stats_cb->mem_root, 2*rec_buff_length)))
{
table_field= *field_ptr;
table_field->read_stats->max_value=
table_field->read_stats->min_value= NULL;
}
uchar *record= stats->min_max_record_buffers;
memset(record, 0, 2*rec_buff_length);
if ((record= (uchar *) alloc_root(&table_share->mem_root, 2*rec_buff_length)))
{
for (uint i=0; i < 2; i++, record+= rec_buff_length)
{
for (field_ptr= table_share->field; *field_ptr; field_ptr++)
for (Field **field_ptr= table_share->field; *field_ptr; field_ptr++)
{
Field *fld;
table_field= *field_ptr;
Field *table_field= *field_ptr;
my_ptrdiff_t diff= record - table_share->default_values;
if (!(fld= table_field->clone(&table_share->mem_root, diff)))
if (!(fld= table_field->clone(&stats_cb->mem_root, diff)))
continue;
store_address_if_first(i == 0 ?
(void **) &table_field->read_stats->min_value :
(void **) &table_field->read_stats->max_value,
(void **) &fld,
is_safe);
if (i == 0)
table_field->read_stats->min_value= fld;
else
table_field->read_stats->max_value= fld;
}
}
}
}
@ -1684,6 +1650,7 @@ int alloc_statistics_for_table(THD* thd, TABLE *table)
DBUG_ENTER("alloc_statistics_for_table");
Table_statistics *table_stats=
(Table_statistics *) alloc_root(&table->mem_root,
sizeof(Table_statistics));
@ -1692,7 +1659,7 @@ int alloc_statistics_for_table(THD* thd, TABLE *table)
Column_statistics_collected *column_stats=
(Column_statistics_collected *) alloc_root(&table->mem_root,
sizeof(Column_statistics_collected) *
fields);
(fields+1));
uint keys= table->s->keys;
Index_statistics *index_stats=
@ -1711,10 +1678,14 @@ int alloc_statistics_for_table(THD* thd, TABLE *table)
table_stats->index_stats= index_stats;
table_stats->idx_avg_frequency= idx_avg_frequency;
memset(column_stats, 0, sizeof(Column_statistics) * fields);
memset(column_stats, 0, sizeof(Column_statistics) * (fields+1));
for (field_ptr= table->field; *field_ptr; field_ptr++, column_stats++)
{
(*field_ptr)->collected_stats= column_stats;
(*field_ptr)->collected_stats->max_value= NULL;
(*field_ptr)->collected_stats->min_value= NULL;
}
memset(idx_avg_frequency, 0, sizeof(ulong) * key_parts);
@ -1728,12 +1699,54 @@ int alloc_statistics_for_table(THD* thd, TABLE *table)
idx_avg_frequency+= key_info->ext_key_parts;
}
create_min_max_stistical_fields_for_table(table);
create_min_max_statistical_fields_for_table(table);
DBUG_RETURN(0);
}
/**
@brief
Check whether any persistent statistics for the processed command is needed
@param
thd The thread handle
@details
The function checks whether any persitent statistics for the processed
command is needed to be read.
@retval
TRUE statistics is needed to be read
@retval
FALSE Otherwise
*/
static
inline bool statistics_for_command_is_needed(THD *thd)
{
if (thd->bootstrap || thd->variables.use_stat_tables == NEVER)
return FALSE;
switch(thd->lex->sql_command) {
case SQLCOM_SELECT:
case SQLCOM_INSERT:
case SQLCOM_INSERT_SELECT:
case SQLCOM_UPDATE:
case SQLCOM_UPDATE_MULTI:
case SQLCOM_DELETE:
case SQLCOM_DELETE_MULTI:
case SQLCOM_REPLACE:
case SQLCOM_REPLACE_SELECT:
break;
default:
return FALSE;
}
return TRUE;
}
/**
@brief
Allocate memory for the statistical data used by a table share
@ -1772,6 +1785,11 @@ int alloc_statistics_for_table(THD* thd, TABLE *table)
Here the second and the third threads try to allocate the memory for
statistical data at the same time. The precautions are taken to
guarantee the correctness of the allocation.
@note
Currently the function always is called with the parameter is_safe set
to FALSE.
*/
int alloc_statistics_for_table_share(THD* thd, TABLE_SHARE *table_share,
@ -1779,70 +1797,111 @@ int alloc_statistics_for_table_share(THD* thd, TABLE_SHARE *table_share,
{
Field **field_ptr;
uint cnt= 0;
KEY *key_info, *end;
TABLE_STATISTICS_CB *stats_cb= &table_share->stats_cb;
DBUG_ENTER("alloc_statistics_for_table_share");
DEBUG_SYNC(thd, "statistics_mem_alloc_start1");
DEBUG_SYNC(thd, "statistics_mem_alloc_start2");
Table_statistics *table_stats=
(Table_statistics *) alloc_root(&table_share->mem_root,
sizeof(Table_statistics));
if (!statistics_for_command_is_needed(thd))
DBUG_RETURN(1);
if (!is_safe)
mysql_mutex_lock(&table_share->LOCK_ha_data);
if (stats_cb->stats_can_be_read)
{
if (!is_safe)
mysql_mutex_unlock(&table_share->LOCK_ha_data);
DBUG_RETURN(0);
}
Table_statistics *table_stats= stats_cb->table_stats;
if (!table_stats)
DBUG_RETURN(1);
memset(table_stats, 0, sizeof(Table_statistics));
store_address_if_first((void **) &table_share->read_stats,
(void **) &table_stats, is_safe);
table_stats= table_share->read_stats;
{
table_stats= (Table_statistics *) alloc_root(&stats_cb->mem_root,
sizeof(Table_statistics));
if (!table_stats)
{
if (!is_safe)
mysql_mutex_unlock(&table_share->LOCK_ha_data);
DBUG_RETURN(1);
}
memset(table_stats, 0, sizeof(Table_statistics));
stats_cb->table_stats= table_stats;
}
for (field_ptr= table_share->field; *field_ptr; field_ptr++, cnt++) ;
Column_statistics *column_stats=
(Column_statistics *) alloc_root(&table_share->mem_root,
sizeof(Column_statistics) * cnt);
uint fields= table_share->fields;
Column_statistics *column_stats= table_stats->column_stats;
if (!column_stats)
DBUG_RETURN(1);
memset(column_stats, 0, sizeof(Column_statistics) * cnt);
store_address_if_first((void **) &table_stats->column_stats,
(void **) &column_stats, is_safe);
column_stats= table_stats->column_stats;
for (field_ptr= table_share->field; *field_ptr; field_ptr++, column_stats++)
(*field_ptr)->read_stats= column_stats;
{
column_stats= (Column_statistics *) alloc_root(&stats_cb->mem_root,
sizeof(Column_statistics) *
(fields+1));
if (column_stats)
{
memset(column_stats, 0, sizeof(Column_statistics) * (fields+1));
table_stats->column_stats= column_stats;
for (field_ptr= table_share->field;
*field_ptr;
field_ptr++, column_stats++)
{
(*field_ptr)->read_stats= column_stats;
(*field_ptr)->read_stats->min_value= NULL;
(*field_ptr)->read_stats->max_value= NULL;
}
create_min_max_statistical_fields_for_table_share(thd, table_share);
}
}
uint keys= table_share->keys;
Index_statistics *index_stats=
(Index_statistics *) alloc_root(&table_share->mem_root,
sizeof(Index_statistics) * keys);
Index_statistics *index_stats= table_stats->index_stats;
if (!index_stats)
DBUG_RETURN(1);
memset(index_stats, 0, sizeof(Index_statistics) * keys);
store_address_if_first((void **) &table_stats->index_stats,
(void **) &index_stats, is_safe);
index_stats= table_stats->index_stats;
{
index_stats= (Index_statistics *) alloc_root(&stats_cb->mem_root,
sizeof(Index_statistics) *
keys);
if (index_stats)
{
table_stats->index_stats= index_stats;
for (key_info= table_share->key_info, end= key_info + keys;
key_info < end;
key_info++, index_stats++)
{
key_info->read_stats= index_stats;
}
}
}
uint key_parts= table_share->ext_key_parts;
ulong *idx_avg_frequency= (ulong*) alloc_root(&table_share->mem_root,
sizeof(ulong) * key_parts);
ulong *idx_avg_frequency= table_stats->idx_avg_frequency;
if (!idx_avg_frequency)
DBUG_RETURN(1);
memset(idx_avg_frequency, 0, sizeof(ulong) * key_parts);
store_address_if_first((void **) &table_stats->idx_avg_frequency,
(void **) &idx_avg_frequency, is_safe);
idx_avg_frequency= table_stats->idx_avg_frequency;
KEY *key_info, *end;
for (key_info= table_share->key_info, end= key_info + table_share->keys;
key_info < end;
key_info++, index_stats++)
{
key_info->read_stats= index_stats;
key_info->read_stats->init_avg_frequency(idx_avg_frequency);
idx_avg_frequency+= key_info->ext_key_parts;
idx_avg_frequency= (ulong*) alloc_root(&stats_cb->mem_root,
sizeof(ulong) * key_parts);
if (idx_avg_frequency)
{
memset(idx_avg_frequency, 0, sizeof(ulong) * key_parts);
table_stats->idx_avg_frequency= idx_avg_frequency;
for (key_info= table_share->key_info, end= key_info + keys;
key_info < end;
key_info++)
{
key_info->read_stats->init_avg_frequency(idx_avg_frequency);
idx_avg_frequency+= key_info->ext_key_parts;
}
}
}
create_min_max_stistical_fields_for_table_share(thd, table_share, is_safe);
if (column_stats && index_stats && idx_avg_frequency)
stats_cb->stats_can_be_read= TRUE;
if (!is_safe)
mysql_mutex_unlock(&table_share->LOCK_ha_data);
DBUG_RETURN(0);
}
@ -2380,6 +2439,7 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables)
}
/* Read statistics from the statistical table index_stats */
Table_statistics *read_stats= table_share->stats_cb.table_stats;
stat_table= stat_tables[INDEX_STAT].table;
Index_stat index_stat(stat_table, table);
for (key_info= table_share->key_info,
@ -2400,7 +2460,7 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables)
KEY *pk_key_info= table_share->key_info + table_share->primary_key;
uint k= key_info->key_parts;
uint pk_parts= pk_key_info->key_parts;
ha_rows n_rows= table_share->read_stats->cardinality;
ha_rows n_rows= read_stats->cardinality;
double k_dist= n_rows / key_info->read_stats->get_avg_frequency(k-1);
uint m= 0;
for (uint j= 0; j < pk_parts; j++)
@ -2427,8 +2487,7 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables)
for (uint l= k; l < k + m; l++)
{
double avg_frequency= key_info->read_stats->get_avg_frequency(l);
if (avg_frequency == 0 ||
table_share->read_stats->cardinality_is_null)
if (avg_frequency == 0 || read_stats->cardinality_is_null)
avg_frequency= 1;
else if (avg_frequency > 1)
{
@ -2466,26 +2525,11 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables)
static
bool statistics_for_tables_is_needed(THD *thd, TABLE_LIST *tables)
{
if (thd->bootstrap || thd->variables.use_stat_tables == 0)
return FALSE;
if (!tables)
return FALSE;
switch(thd->lex->sql_command) {
case SQLCOM_SELECT:
case SQLCOM_INSERT:
case SQLCOM_INSERT_SELECT:
case SQLCOM_UPDATE:
case SQLCOM_UPDATE_MULTI:
case SQLCOM_DELETE:
case SQLCOM_DELETE_MULTI:
case SQLCOM_REPLACE:
case SQLCOM_REPLACE_SELECT:
break;
default:
if (!statistics_for_command_is_needed(thd))
return FALSE;
}
/*
Do not read statistics for any query over non-user tables.
@ -2497,7 +2541,9 @@ bool statistics_for_tables_is_needed(THD *thd, TABLE_LIST *tables)
if (!tl->is_view_or_derived() && tl->table)
{
TABLE_SHARE *table_share= tl->table->s;
if (table_share && table_share->table_category != TABLE_CATEGORY_USER)
if (table_share &&
(table_share->table_category != TABLE_CATEGORY_USER ||
table_share->tmp_table != NO_TMP_TABLE))
return FALSE;
}
}
@ -2508,8 +2554,8 @@ bool statistics_for_tables_is_needed(THD *thd, TABLE_LIST *tables)
{
TABLE_SHARE *table_share= tl->table->s;
if (table_share &&
table_share->stats_can_be_read &&
!table_share->stats_is_read)
table_share->stats_cb.stats_can_be_read &&
!table_share->stats_cb.stats_is_read)
return TRUE;
}
}
@ -2564,11 +2610,11 @@ int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables)
{
TABLE_SHARE *table_share= tl->table->s;
if (table_share &&
table_share->stats_can_be_read &&
!table_share->stats_is_read)
table_share->stats_cb.stats_can_be_read &&
!table_share->stats_cb.stats_is_read)
{
(void) read_statistics_for_table(thd, tl->table, stat_tables);
table_share->stats_is_read= TRUE;
table_share->stats_cb.stats_is_read= TRUE;
}
}
}
@ -2983,20 +3029,20 @@ int rename_column_in_stat_tables(THD *thd, TABLE *tab, Field *col,
void set_statistics_for_table(THD *thd, TABLE *table)
{
TABLE_STATISTICS_CB *stats_cb= &table->s->stats_cb;
Table_statistics *read_stats= stats_cb->table_stats;
Use_stat_tables_mode use_stat_table_mode= get_use_stat_tables_mode(thd);
table->used_stat_records=
(use_stat_table_mode <= COMPLEMENTARY ||
!table->s->stats_is_read || !table->s->read_stats ||
table->s->read_stats->cardinality_is_null) ?
table->file->stats.records : table->s->read_stats->cardinality;
!stats_cb->stats_is_read || read_stats->cardinality_is_null) ?
table->file->stats.records : read_stats->cardinality;
KEY *key_info, *key_info_end;
for (key_info= table->key_info, key_info_end= key_info+table->s->keys;
key_info < key_info_end; key_info++)
{
key_info->is_statistics_from_stat_tables=
(use_stat_table_mode > COMPLEMENTARY &&
table->s->stats_is_read &&
key_info->read_stats &&
stats_cb->stats_is_read &&
key_info->read_stats->avg_frequency_is_inited() &&
key_info->read_stats->get_avg_frequency(0) > 0.5);
}

View File

@ -102,6 +102,7 @@ class Table_statistics
public:
my_bool cardinality_is_null; /* TRUE if the cardinality is unknown */
ha_rows cardinality; /* Number of rows in the table */
uchar *min_max_record_buffers; /* Record buffers for min/max values */
Column_statistics *column_stats; /* Array of statistical data for columns */
Index_statistics *index_stats; /* Array of statistical data for indexes */
ulong *idx_avg_frequency; /* Array of records per key for index prefixes */

View File

@ -4146,7 +4146,8 @@ bool mysql_create_table_no_lock(THD *thd,
set_table_default_charset(thd, create_info, (char*) db);
db_options= create_info->table_options;
if (create_info->row_type != ROW_TYPE_FIXED &&
if (!create_info->frm_only &&
create_info->row_type != ROW_TYPE_FIXED &&
create_info->row_type != ROW_TYPE_DEFAULT)
db_options|= HA_OPTION_PACK_RECORD;
alias= table_case_name(create_info, table_name);
@ -4573,7 +4574,8 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
*/
if (open_and_lock_tables(thd, thd->lex->query_tables, FALSE, 0))
{
result= TRUE;
/* is_error() may be 0 if table existed and we generated a warning */
result= thd->is_error();
goto end;
}
@ -4769,7 +4771,10 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
properly isolated from all concurrent operations which matter.
*/
if (open_tables(thd, &thd->lex->query_tables, &not_used, 0))
{
res= thd->is_error();
goto err;
}
src_table->table->use_all_columns();
DEBUG_SYNC(thd, "create_table_like_after_open");
@ -6790,9 +6795,19 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
my_sleep(100000););
/*
Create a table with a temporary name.
With create_info->frm_only == 1 this creates a .frm file only.
With create_info->frm_only == 1 this creates a .frm file only and
we keep the original row format.
We don't log the statement, it will be logged later.
*/
if (need_copy_table == ALTER_TABLE_METADATA_ONLY)
{
DBUG_ASSERT(create_info->frm_only);
/* Ensure we keep the original table format */
create_info->table_options= ((create_info->table_options &
~HA_OPTION_PACK_RECORD) |
(table->s->db_create_options &
HA_OPTION_PACK_RECORD));
}
tmp_disable_binlog(thd);
error= mysql_create_table_no_lock(thd, new_db, tmp_name,
create_info,

View File

@ -340,6 +340,8 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
share->free_tables.empty();
share->m_flush_tickets.empty();
init_sql_alloc(&share->stats_cb.mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
memcpy((char*) &share->mem_root, (char*) &mem_root, sizeof(mem_root));
mysql_mutex_init(key_TABLE_SHARE_LOCK_ha_data,
&share->LOCK_ha_data, MY_MUTEX_INIT_FAST);
@ -420,6 +422,14 @@ void TABLE_SHARE::destroy()
uint idx;
KEY *info_it;
if (tmp_table == NO_TMP_TABLE)
mysql_mutex_lock(&LOCK_ha_data);
free_root(&stats_cb.mem_root, MYF(0));
stats_cb.stats_can_be_read= FALSE;
stats_cb.stats_is_read= FALSE;
if (tmp_table == NO_TMP_TABLE)
mysql_mutex_unlock(&LOCK_ha_data);
/* The mutex is initialized only for shares that are part of the TDC */
if (tmp_table == NO_TMP_TABLE)
mysql_mutex_destroy(&LOCK_ha_data);

View File

@ -562,6 +562,21 @@ typedef I_P_List <Wait_for_flush,
Wait_for_flush_list;
/**
Control block to access table statistics loaded
from persistent statistical tables
*/
struct TABLE_STATISTICS_CB
{
MEM_ROOT mem_root; /* MEM_ROOT to allocate statistical data for the table */
Table_statistics *table_stats; /* Structure to access the statistical data */
bool stats_can_be_read; /* Memory for statistical data is allocated */
bool stats_is_read; /* Statistical data for table has been read
from statistical tables */
};
/**
This structure is shared between different table objects. There is one
instance of table share per one table in the database.
@ -599,14 +614,7 @@ struct TABLE_SHARE
KEY *key_info; /* data of keys in database */
uint *blob_field; /* Index to blobs in Field arrray*/
bool stats_can_be_read; /* Memory for statistical data is allocated */
bool stats_is_read; /* Statistical data for table has been read
from statistical tables */
/*
This structure is used for statistical data on the table
that has been read from the statistical table table_stat
*/
Table_statistics *read_stats;
TABLE_STATISTICS_CB stats_cb;
uchar *default_values; /* row with default values */
LEX_STRING comment; /* Comment about table */

View File

@ -173,7 +173,6 @@ void threadpool_remove_connection(THD *thd)
close_connection(thd, 0);
unlink_thd(thd);
mysql_mutex_unlock(&LOCK_thread_count);
mysql_cond_broadcast(&COND_thread_count);
/*

View File

@ -501,13 +501,7 @@ mutex_spin_wait(
{
ulint index; /* index of the reserved wait cell */
ulint i; /* spin round count */
#ifdef UNIV_DEBUG
ib_int64_t lstart_time = 0, lfinish_time; /* for timing os_wait */
ulint ltime_diff;
ulint sec;
ulint ms;
uint timer_started = 0;
#endif /* UNIV_DEBUG */
ut_ad(mutex);
/* This update is not thread safe, but we don't mind if the count
@ -540,13 +534,6 @@ spin_loop:
if (i == SYNC_SPIN_ROUNDS) {
#ifdef UNIV_DEBUG
mutex->count_os_yield++;
#ifndef UNIV_HOTBACKUP
if (timed_mutexes && timer_started == 0) {
ut_usectime(&sec, &ms);
lstart_time= (ib_int64_t)sec * 1000000 + ms;
timer_started = 1;
}
#endif /* UNIV_HOTBACKUP */
#endif /* UNIV_DEBUG */
os_thread_yield();
}
@ -639,34 +626,13 @@ spin_loop:
mutex_os_wait_count++;
mutex->count_os_wait++;
#ifdef UNIV_DEBUG
/* !!!!! Sometimes os_wait can be called without os_thread_yield */
#ifndef UNIV_HOTBACKUP
if (timed_mutexes == 1 && timer_started == 0) {
ut_usectime(&sec, &ms);
lstart_time= (ib_int64_t)sec * 1000000 + ms;
timer_started = 1;
}
#endif /* UNIV_HOTBACKUP */
#endif /* UNIV_DEBUG */
sync_array_wait_event(sync_primary_wait_array, index);
goto mutex_loop;
finish_timing:
#ifdef UNIV_DEBUG
if (timed_mutexes == 1 && timer_started==1) {
ut_usectime(&sec, &ms);
lfinish_time= (ib_int64_t)sec * 1000000 + ms;
ltime_diff= (ulint) (lfinish_time - lstart_time);
mutex->lspent_time += ltime_diff;
if (mutex->lmax_spent_time < ltime_diff) {
mutex->lmax_spent_time= ltime_diff;
}
}
#endif /* UNIV_DEBUG */
return;
}

View File

@ -165,6 +165,7 @@ vio/viosslfactories\.c: discards ~const~ qualifier from pointer target type
# Groff warnings on OpenSUSE.
#
.*/dbug/.*(groff|<standard input>) : .*
.*groff.* : vertical spacing must be greater than
#
# Warnings on OpenSolaris

View File

@ -19072,7 +19072,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug58036", test_bug58036 },
{ "test_bug57058", test_bug57058 },
{ "test_bug56976", test_bug56976 },
{ "test_mdev3855", test_mdev3885 },
{ "test_mdev3885", test_mdev3885 },
{ "test_bug11766854", test_bug11766854 },
{ "test_bug12337762", test_bug12337762 },
{ "test_progress_reporting", test_progress_reporting },

View File

@ -43,6 +43,8 @@
<Property Id="SKIPNETWORKING" Secure="yes"/>
<!-- Whether to keep default (unauthenticated) user. Default is no-->
<Property Id="DEFAULTUSER" Secure="yes"/>
<!-- Set server character set to UTF8 -->
<Property Id="UTF8" Secure="yes"/>
<!-- Whether to data on uninstall (default yes, after asking user consent) -->
<Property Id="CLEANUPDATA" Secure="yes" Value="1"/>
<!-- Force per machine installation -->
@ -272,6 +274,10 @@
<Text>Please note: this setting can lead to insecure systems.</Text>
</Control>
<Control Id="CheckBoxUTF8" Type="CheckBox" X="8" Y="215" Width="250" Height="18" Property="UTF8" CheckBoxValue="1" TabSkip="no">
<Text>{\Font1}Use UTF8 as default server's character set</Text>
</Control>
<!-- Navigation buttons-->
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
<Publish Event="NewDialog" Value="CustomizeDlg">1</Publish>
@ -519,6 +525,20 @@
Value="ON" />
</Component>
<Component Id="C.utf8" Guid="*" Directory="DATADIR">
<Condition>UTF8</Condition>
<RegistryValue Root='HKLM'
Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
Name='UTF8' Value='1' Type='string' KeyPath='yes'/>
<IniFile Id="Ini6"
Action="createLine"
Directory="DATADIR"
Section="mysqld"
Name="my.ini"
Key="character-set-server"
Value="utf8" />
</Component>
<!--- Grant service account permission to the database folder (Windows 7 and later) -->
<Component Id="C.serviceaccount.permission" Guid="*" Directory='DATADIR' Transitive='yes'>
<Condition><![CDATA[SERVICENAME AND (VersionNT > 600)]]></Condition>