Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
5fa73f08
Commit
5fa73f08
authored
Mar 16, 2010
by
Martin Hansson
Browse files
Options
Browse Files
Download
Plain Diff
Merge of fix for Bug#47762.
parents
7cb79671
9ecdd588
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
544 additions
and
18 deletions
+544
-18
mysql-test/r/partition_error.result
mysql-test/r/partition_error.result
+42
-0
mysql-test/r/partition_innodb.result
mysql-test/r/partition_innodb.result
+70
-1
mysql-test/r/partition_pruning.result
mysql-test/r/partition_pruning.result
+95
-11
mysql-test/r/partition_range.result
mysql-test/r/partition_range.result
+14
-0
mysql-test/r/type_date.result
mysql-test/r/type_date.result
+21
-0
mysql-test/suite/parts/inc/partition_auto_increment.inc
mysql-test/suite/parts/inc/partition_auto_increment.inc
+18
-0
mysql-test/suite/parts/r/partition_auto_increment_archive.result
...est/suite/parts/r/partition_auto_increment_archive.result
+9
-0
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result
...t/suite/parts/r/partition_auto_increment_blackhole.result
+10
-0
mysql-test/suite/parts/r/partition_auto_increment_innodb.result
...test/suite/parts/r/partition_auto_increment_innodb.result
+9
-1
mysql-test/suite/parts/r/partition_auto_increment_memory.result
...test/suite/parts/r/partition_auto_increment_memory.result
+10
-0
mysql-test/suite/parts/r/partition_auto_increment_myisam.result
...test/suite/parts/r/partition_auto_increment_myisam.result
+10
-0
mysql-test/suite/parts/r/partition_auto_increment_ndb.result
mysql-test/suite/parts/r/partition_auto_increment_ndb.result
+8
-0
mysql-test/suite/rpl/r/rpl_stm_sql_mode.result
mysql-test/suite/rpl/r/rpl_stm_sql_mode.result
+18
-0
mysql-test/suite/rpl/t/rpl_stm_sql_mode.test
mysql-test/suite/rpl/t/rpl_stm_sql_mode.test
+24
-0
mysql-test/t/partition_error.test
mysql-test/t/partition_error.test
+24
-0
mysql-test/t/partition_innodb.test
mysql-test/t/partition_innodb.test
+60
-1
mysql-test/t/partition_pruning.test
mysql-test/t/partition_pruning.test
+28
-0
mysql-test/t/partition_range.test
mysql-test/t/partition_range.test
+18
-0
mysql-test/t/type_date.test
mysql-test/t/type_date.test
+20
-0
sql/ha_partition.cc
sql/ha_partition.cc
+15
-1
sql/item.h
sql/item.h
+5
-0
sql/log.cc
sql/log.cc
+1
-1
sql/sql_partition.cc
sql/sql_partition.cc
+15
-2
No files found.
mysql-test/r/partition_error.result
View file @
5fa73f08
drop table if exists t1;
#
# Bug#50392: insert_id is not reset for partitioned tables
# auto_increment on duplicate entry
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY);
SET INSERT_ID= 13;
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID= 12;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
ERROR 23000: Duplicate entry '13' for key 'PRIMARY'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`a`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1;
a
12
13
14
DROP TABLE t1;
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) PARTITION BY KEY(a);
SET INSERT_ID= 13;
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID= 12;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
ERROR 23000: Duplicate entry '13' for key 'PRIMARY'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`a`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) */
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1;
a
12
13
14
DROP TABLE t1;
CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a));
INSERT INTO t1 VALUES (1),(1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
...
...
mysql-test/r/partition_innodb.result
View file @
5fa73f08
drop table if exists t1;
drop table if exists t1, t2;
#
# Bug#51830: Incorrect partition pruning on range partition (regression)
#
CREATE TABLE t1 (a INT NOT NULL)
ENGINE = InnoDB
PARTITION BY RANGE(a)
(PARTITION p10 VALUES LESS THAN (10),
PARTITION p30 VALUES LESS THAN (30),
PARTITION p50 VALUES LESS THAN (50),
PARTITION p70 VALUES LESS THAN (70),
PARTITION p90 VALUES LESS THAN (90));
INSERT INTO t1 VALUES (10),(30),(50);
INSERT INTO t1 VALUES (70);
INSERT INTO t1 VALUES (80);
INSERT INTO t1 VALUES (89);
INSERT INTO t1 VALUES (90);
ERROR HY000: Table has no partition for value 90
INSERT INTO t1 VALUES (100);
ERROR HY000: Table has no partition for value 100
insert INTO t1 VALUES (110);
ERROR HY000: Table has no partition for value 110
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 90;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 90;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 90;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 89;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 7 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 89;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 7 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 89;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 100;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 100;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 100;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where
DROP TABLE t1;
#
# Bug#50104: Partitioned table with just 1 partion works with fk
#
CREATE TABLE t2 (
id INT,
PRIMARY KEY (id)
) ENGINE=InnoDB ;
CREATE TABLE t1 (
id INT NOT NULL AUTO_INCREMENT,
parent_id INT DEFAULT NULL,
PRIMARY KEY (id),
KEY parent_id (parent_id)
) ENGINE=InnoDB;
ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 1;
ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id);
ERROR HY000: Foreign key clause is not yet supported in conjunction with partitioning
ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 2;
ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id);
ERROR HY000: Foreign key clause is not yet supported in conjunction with partitioning
DROP TABLE t1, t2;
create table t1 (a int not null,
b datetime not null,
primary key (a,b))
...
...
mysql-test/r/partition_pruning.result
View file @
5fa73f08
This diff is collapsed.
Click to expand it.
mysql-test/r/partition_range.result
View file @
5fa73f08
drop table if exists t1, t2;
#
# Bug#48229: group by performance issue of partitioned table
#
CREATE TABLE t1 (
a INT,
b INT,
KEY a (a,b)
)
PARTITION BY HASH (a) PARTITIONS 1;
INSERT INTO t1 VALUES (0, 580092), (3, 894076), (4, 805483), (4, 913540), (6, 611137), (8, 171602), (9, 599495), (9, 746305), (10, 272829), (10, 847519), (12, 258869), (12, 929028), (13, 288970), (15, 20971), (15, 105839), (16, 788272), (17, 76914), (18, 827274), (19, 802258), (20, 123677), (20, 587729), (22, 701449), (25, 31565), (25, 230782), (25, 442887), (25, 733139), (25, 851020);
EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100, 3) GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index
DROP TABLE t1;
create table t1 (a int)
partition by range (a)
( partition p0 values less than (maxvalue));
...
...
mysql-test/r/type_date.result
View file @
5fa73f08
...
...
@@ -275,4 +275,25 @@ select * from t1 where a between '0000-00-01' and '0000-00-02';
a
0000-00-01
drop table t1;
#
# Bug#50918: Date columns treated differently in Views than in Base
# Tables
#
CREATE TABLE t1 ( the_date DATE, the_time TIME );
INSERT INTO t1 VALUES ( '2010-01-01', '01:01:01' );
SELECT * FROM t1 t11 JOIN t1 t12 ON addtime( t11.the_date, t11.the_time ) =
addtime( t12.the_date, t12.the_time );
the_date the_time the_date the_time
2010-01-01 01:01:01 2010-01-01 01:01:01
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT * FROM t1 JOIN v1 ON addtime( t1.the_date, t1.the_time ) =
addtime( v1.the_date, v1.the_time );
the_date the_time the_date the_time
2010-01-01 01:01:01 2010-01-01 01:01:01
SELECT * FROM t1 JOIN v1 ON addtime( t1.the_date, t1.the_time ) =
addtime( cast(v1.the_date AS DATETIME), v1.the_time );
the_date the_time the_date the_time
2010-01-01 01:01:01 2010-01-01 01:01:01
DROP TABLE t1;
DROP VIEW v1;
End of 5.1 tests
mysql-test/suite/parts/inc/partition_auto_increment.inc
View file @
5fa73f08
...
...
@@ -42,6 +42,15 @@ if ($mysql_errno)
INSERT
INTO
t1
VALUES
(
NULL
);
SET
INSERT_ID
=
30
;
INSERT
INTO
t1
VALUES
(
NULL
);
SET
INSERT_ID
=
29
;
--
error
0
,
ER_DUP_ENTRY
,
ER_DUP_KEY
INSERT
INTO
t1
VALUES
(
NULL
),
(
NULL
),
(
NULL
);
if
(
!
$mysql_errno
)
{
echo
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
echo
# mysql_errno: $mysql_errno;
}
INSERT
INTO
t1
VALUES
(
NULL
);
if
(
!
$skip_update
)
{
# InnoDB Does not handle this correctly, see bug#14793, bug#21641
...
...
@@ -601,6 +610,15 @@ SET INSERT_ID = 23;
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
(
c1
)
VALUES
(
NULL
);
SHOW
CREATE
TABLE
t1
;
SET
INSERT_ID
=
22
;
--
error
0
,
ER_DUP_ENTRY
,
ER_DUP_KEY
INSERT
INTO
t1
VALUES
(
NULL
),
(
NULL
),
(
NULL
);
if
(
!
$mysql_errno
)
{
echo
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY;
echo
# mysql_errno: $mysql_errno;
}
INSERT
INTO
t1
VALUES
(
NULL
);
SELECT
*
FROM
t1
ORDER
BY
c1
;
DROP
TABLE
t1
;
...
...
mysql-test/suite/parts/r/partition_auto_increment_archive.result
View file @
5fa73f08
...
...
@@ -34,6 +34,9 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 29;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 ORDER BY c1;
c1
2
...
...
@@ -46,6 +49,7 @@ c1
21
22
30
31
DROP TABLE t1;
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
...
...
@@ -751,10 +755,15 @@ t1 CREATE TABLE `t1` (
) ENGINE=ARCHIVE AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
SET INSERT_ID = 22;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 ORDER BY c1;
c1
1
22
23
24
DROP TABLE t1;
# Testing with FLUSH TABLE
CREATE TABLE t1 (
...
...
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result
View file @
5fa73f08
...
...
@@ -35,6 +35,11 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 29;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
# mysql_errno: 0
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
FLUSH TABLES;
...
...
@@ -597,6 +602,11 @@ t1 CREATE TABLE `t1` (
) ENGINE=BLACKHOLE AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
SET INSERT_ID = 22;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
# mysql_errno: 0
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 ORDER BY c1;
c1
DROP TABLE t1;
...
...
mysql-test/suite/parts/r/partition_auto_increment_innodb.result
View file @
5fa73f08
...
...
@@ -33,6 +33,9 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 29;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
FLUSH TABLES;
...
...
@@ -40,7 +43,7 @@ UPDATE t1 SET c1 = 40 WHERE c1 = 50;
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
AND TABLE_NAME='t1';
AUTO_INCREMENT
3
1
3
2
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
Warnings:
Warning 1048 Column 'c1' cannot be null
...
...
@@ -60,6 +63,7 @@ c1
30
31
32
33
40
51
DROP TABLE t1;
...
...
@@ -771,10 +775,14 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
SET INSERT_ID = 22;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 ORDER BY c1;
c1
1
23
24
DROP TABLE t1;
# Testing with FLUSH TABLE
CREATE TABLE t1 (
...
...
mysql-test/suite/parts/r/partition_auto_increment_memory.result
View file @
5fa73f08
...
...
@@ -33,6 +33,9 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 29;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
FLUSH TABLES;
...
...
@@ -57,7 +60,9 @@ c1
21
22
23
29
30
31
40
51
52
...
...
@@ -797,10 +802,15 @@ t1 CREATE TABLE `t1` (
) ENGINE=MEMORY AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
SET INSERT_ID = 22;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 ORDER BY c1;
c1
1
22
23
24
DROP TABLE t1;
# Testing with FLUSH TABLE
CREATE TABLE t1 (
...
...
mysql-test/suite/parts/r/partition_auto_increment_myisam.result
View file @
5fa73f08
...
...
@@ -33,6 +33,9 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 29;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
FLUSH TABLES;
...
...
@@ -57,7 +60,9 @@ c1
21
22
23
29
30
31
40
51
52
...
...
@@ -816,10 +821,15 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
SET INSERT_ID = 22;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 ORDER BY c1;
c1
1
22
23
24
DROP TABLE t1;
# Testing with FLUSH TABLE
CREATE TABLE t1 (
...
...
mysql-test/suite/parts/r/partition_auto_increment_ndb.result
View file @
5fa73f08
...
...
@@ -34,6 +34,9 @@ INSERT INTO t1 VALUES (NULL), (10), (NULL);
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID = 29;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
FLUSH TABLES;
...
...
@@ -58,6 +61,7 @@ c1
21
22
23
24
30
40
51
...
...
@@ -792,9 +796,13 @@ t1 CREATE TABLE `t1` (
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
SET INSERT_ID = 22;
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 ORDER BY c1;
c1
1
2
23
DROP TABLE t1;
# Testing with FLUSH TABLE
...
...
mysql-test/suite/rpl/r/rpl_stm_sql_mode.result
0 → 100644
View file @
5fa73f08
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (pk integer auto_increment , primary key (pk));
SET SESSION SQL_MODE='traditional';
# **** [MASTER] *****
# action: raise DUP KEY error (error code should be set in the
# query log event)
INSERT INTO t1 (`pk`) VALUES (1), (1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
DROP TABLE t1;
# **** [ sync slave with master ] ****
# assertion: sync slave with master makes slave not to stop with
# duplicate key error (because it has received event
# with expected error code).
mysql-test/suite/rpl/t/rpl_stm_sql_mode.test
0 → 100644
View file @
5fa73f08
--
source
include
/
master
-
slave
.
inc
--
source
include
/
have_binlog_format_statement
.
inc
#
# Bug #51055 Replication failure on duplicate key + traditional SQL mode
#
CREATE
TABLE
t1
(
pk
integer
auto_increment
,
primary
key
(
pk
));
SET
SESSION
SQL_MODE
=
'traditional'
;
--
echo
# **** [MASTER] *****
--
echo
# action: raise DUP KEY error (error code should be set in the
--
echo
# query log event)
--
error
ER_DUP_ENTRY
INSERT
INTO
t1
(
`pk`
)
VALUES
(
1
),
(
1
);
DROP
TABLE
t1
;
--
echo
# **** [ sync slave with master ] ****
--
echo
# assertion: sync slave with master makes slave not to stop with
--
echo
# duplicate key error (because it has received event
--
echo
# with expected error code).
--
sync_slave_with_master
mysql-test/t/partition_error.test
View file @
5fa73f08
...
...
@@ -8,6 +8,30 @@
drop
table
if
exists
t1
;
--
enable_warnings
--
echo
#
--
echo
# Bug#50392: insert_id is not reset for partitioned tables
--
echo
# auto_increment on duplicate entry
CREATE
TABLE
t1
(
a
INT
AUTO_INCREMENT
PRIMARY
KEY
);
SET
INSERT_ID
=
13
;
INSERT
INTO
t1
VALUES
(
NULL
);
SET
INSERT_ID
=
12
;
--
error
ER_DUP_ENTRY
INSERT
INTO
t1
VALUES
(
NULL
),
(
NULL
),
(
NULL
);
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
VALUES
(
NULL
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
INT
AUTO_INCREMENT
PRIMARY
KEY
)
PARTITION
BY
KEY
(
a
);
SET
INSERT_ID
=
13
;
INSERT
INTO
t1
VALUES
(
NULL
);
SET
INSERT_ID
=
12
;
--
error
ER_DUP_ENTRY
INSERT
INTO
t1
VALUES
(
NULL
),
(
NULL
),
(
NULL
);
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
VALUES
(
NULL
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
#
# Bug#38719: Partitioning returns a different error code for a
# duplicate key error
...
...
mysql-test/t/partition_innodb.test
View file @
5fa73f08
...
...
@@ -2,11 +2,70 @@
--
source
include
/
have_innodb
.
inc
--
disable_warnings
drop
table
if
exists
t1
;
drop
table
if
exists
t1
,
t2
;
--
enable_warnings
let
$MYSQLD_DATADIR
=
`SELECT @@datadir`
;
--
echo
#
--
echo
# Bug#51830: Incorrect partition pruning on range partition (regression)
--
echo
#
CREATE
TABLE
t1
(
a
INT
NOT
NULL
)
ENGINE
=
InnoDB
PARTITION
BY
RANGE
(
a
)
(
PARTITION
p10
VALUES
LESS
THAN
(
10
),
PARTITION
p30
VALUES
LESS
THAN
(
30
),
PARTITION
p50
VALUES
LESS
THAN
(
50
),
PARTITION
p70
VALUES
LESS
THAN
(
70
),
PARTITION
p90
VALUES
LESS
THAN
(
90
));
INSERT
INTO
t1
VALUES
(
10
),(
30
),(
50
);
INSERT
INTO
t1
VALUES
(
70
);
INSERT
INTO
t1
VALUES
(
80
);
INSERT
INTO
t1
VALUES
(
89
);
--
error
ER_NO_PARTITION_FOR_GIVEN_VALUE
INSERT
INTO
t1
VALUES
(
90
);
--
error
ER_NO_PARTITION_FOR_GIVEN_VALUE
INSERT
INTO
t1
VALUES
(
100
);
--
error
ER_NO_PARTITION_FOR_GIVEN_VALUE
insert
INTO
t1
VALUES
(
110
);
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
>
90
;
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
>=
90
;
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
=
90
;
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
=
89
;
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
>=
89
;
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
>
89
;
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
=
100
;
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
>=
100
;
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
>
100
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug#50104: Partitioned table with just 1 partion works with fk
--
echo
#
CREATE
TABLE
t2
(
id
INT
,
PRIMARY
KEY
(
id
)
)
ENGINE
=
InnoDB
;
CREATE
TABLE
t1
(
id
INT
NOT
NULL
AUTO_INCREMENT
,
parent_id
INT
DEFAULT
NULL
,
PRIMARY
KEY
(
id
),
KEY
parent_id
(
parent_id
)
)
ENGINE
=
InnoDB
;
ALTER
TABLE
t1
PARTITION
BY
HASH
(
id
)
PARTITIONS
1
;
--
error
ER_FOREIGN_KEY_ON_PARTITIONED
ALTER
TABLE
t1
ADD
CONSTRAINT
test_ibfk_1
FOREIGN
KEY
(
parent_id
)
REFERENCES
t2
(
id
);
ALTER
TABLE
t1
PARTITION
BY
HASH
(
id
)
PARTITIONS
2
;
--
error
ER_FOREIGN_KEY_ON_PARTITIONED
ALTER
TABLE
t1
ADD
CONSTRAINT
test_ibfk_1
FOREIGN
KEY
(
parent_id
)
REFERENCES
t2
(
id
);
DROP
TABLE
t1
,
t2
;
#
# Bug#47029: Crash when reorganize partition with subpartition
#
...
...
mysql-test/t/partition_pruning.test
View file @
5fa73f08
...
...
@@ -702,15 +702,29 @@ insert into t7 values (10),(30),(50);
# leftmost intervals
explain
partitions
select
*
from
t7
where
a
<
5
;
explain
partitions
select
*
from
t7
where
a
<
9
;
explain
partitions
select
*
from
t7
where
a
<=
9
;
explain
partitions
select
*
from
t7
where
a
=
9
;
explain
partitions
select
*
from
t7
where
a
>=
9
;
explain
partitions
select
*
from
t7
where
a
>
9
;
explain
partitions
select
*
from
t7
where
a
<
10
;
explain
partitions
select
*
from
t7
where
a
<=
10
;
explain
partitions
select
*
from
t7
where
a
=
10
;
explain
partitions
select
*
from
t7
where
a
>=
10
;
explain
partitions
select
*
from
t7
where
a
>
10
;
#rightmost intervals
explain
partitions
select
*
from
t7
where
a
<
89
;
explain
partitions
select
*
from
t7
where
a
<=
89
;
explain
partitions
select
*
from
t7
where
a
=
89
;
explain
partitions
select
*
from
t7
where
a
>
89
;
explain
partitions
select
*
from
t7
where
a
>=
89
;
explain
partitions
select
*
from
t7
where
a
<
90
;
explain
partitions
select
*
from
t7
where
a
<=
90
;
explain
partitions
select
*
from
t7
where
a
=
90
;
explain
partitions
select
*
from
t7
where
a
>
90
;
explain
partitions
select
*
from
t7
where
a
>=
90
;
explain
partitions
select
*
from
t7
where
a
>
91
;
# misc intervals
explain
partitions
select
*
from
t7
where
a
>
11
and
a
<
29
;
...
...
@@ -728,15 +742,29 @@ insert into t7 values (10),(30),(50);
# leftmost intervals
explain
partitions
select
*
from
t7
where
a
<
5
;
explain
partitions
select
*
from
t7
where
a
<
9
;
explain
partitions
select
*
from
t7
where
a
<=
9
;
explain
partitions
select
*
from
t7
where
a
=
9
;
explain
partitions
select
*
from
t7
where
a
>=
9
;
explain
partitions
select
*
from
t7
where
a
>
9
;
explain
partitions
select
*
from
t7
where
a
<
10
;
explain
partitions
select
*
from
t7
where
a
<=
10
;
explain
partitions
select
*
from
t7
where
a
=
10
;
explain
partitions
select
*
from
t7
where
a
>=
10
;
explain
partitions
select
*
from
t7
where
a
>
10
;
#rightmost intervals
explain
partitions
select
*
from
t7
where
a
<
89
;
explain
partitions
select
*
from
t7
where
a
<=
89
;
explain
partitions
select
*
from
t7
where
a
=
89
;
explain
partitions
select
*
from
t7
where
a
>
89
;
explain
partitions
select
*
from
t7
where
a
>=
89
;
explain
partitions
select
*
from
t7
where
a
<
90
;
explain
partitions
select
*
from
t7
where
a
<=
90
;
explain
partitions
select
*
from
t7
where
a
=
90
;
explain
partitions
select
*
from
t7
where
a
>
90
;
explain
partitions
select
*
from
t7
where
a
>=
90
;
explain
partitions
select
*
from
t7
where
a
>
91
;
# misc intervals
explain
partitions
select
*
from
t7
where
a
>
11
and
a
<
29
;
...
...
mysql-test/t/partition_range.test
View file @
5fa73f08
...
...
@@ -9,6 +9,24 @@
drop
table
if
exists
t1
,
t2
;
--
enable_warnings
--
echo
#
--
echo
# Bug#48229: group by performance issue of partitioned table
--
echo
#
CREATE
TABLE
t1
(
a
INT
,
b
INT
,
KEY
a
(
a
,
b
)
)
PARTITION
BY
HASH
(
a
)
PARTITIONS
1
;
# insert some rows (i.e. so that rows/blocks > 1)
INSERT
INTO
t1
VALUES
(
0
,
580092
),
(
3
,
894076
),
(
4
,
805483
),
(
4
,
913540
),
(
6
,
611137
),
(
8
,
171602
),
(
9
,
599495
),
(
9
,
746305
),
(
10
,
272829
),
(
10
,
847519
),
(
12
,
258869
),
(
12
,
929028
),
(
13
,
288970
),
(
15
,
20971
),
(
15
,
105839
),
(
16
,
788272
),
(
17
,
76914
),
(
18
,
827274
),
(
19
,
802258
),
(
20
,
123677
),
(
20
,
587729
),
(
22
,
701449
),
(
25
,
31565
),
(
25
,
230782
),
(
25
,
442887
),
(
25
,
733139
),
(
25
,
851020
);
# Before the fix the 'Extra' column showed 'Using index for group-by'
EXPLAIN
SELECT
a
,
MAX
(
b
)
FROM
t1
WHERE
a
IN
(
10
,
100
,
3
)
GROUP
BY
a
;
DROP
TABLE
t1
;
#
# BUG 33429: Succeeds in adding partition when maxvalue on last partition
#
...
...
mysql-test/t/type_date.test
View file @
5fa73f08
...
...
@@ -246,4 +246,24 @@ insert into t1 values ('0000-01-01'), ('0000-00-01'), ('0001-01-01');
select
*
from
t1
where
a
between
'0000-00-01'
and
'0000-00-02'
;
drop
table
t1
;
--
echo
#
--
echo
# Bug#50918: Date columns treated differently in Views than in Base
--
echo
# Tables
--
echo
#
CREATE
TABLE
t1
(
the_date
DATE
,
the_time
TIME
);
INSERT
INTO
t1
VALUES
(
'2010-01-01'
,
'01:01:01'
);
SELECT
*
FROM
t1
t11
JOIN
t1
t12
ON
addtime
(
t11
.
the_date
,
t11
.
the_time
)
=
addtime
(
t12
.
the_date
,
t12
.
the_time
);
CREATE
VIEW
v1
AS
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
JOIN
v1
ON
addtime
(
t1
.
the_date
,
t1
.
the_time
)
=
addtime
(
v1
.
the_date
,
v1
.
the_time
);
SELECT
*
FROM
t1
JOIN
v1
ON
addtime
(
t1
.
the_date
,
t1
.
the_time
)
=
addtime
(
cast
(
v1
.
the_date
AS
DATETIME
),
v1
.
the_time
);
DROP
TABLE
t1
;
DROP
VIEW
v1
;
--
echo
End
of
5.1
tests
sql/ha_partition.cc
View file @
5fa73f08
...
...
@@ -5090,6 +5090,7 @@ int ha_partition::info(uint flag)
file
=
m_file
[
handler_instance
];
file
->
info
(
HA_STATUS_CONST
);
stats
.
block_size
=
file
->
stats
.
block_size
;
stats
.
create_time
=
file
->
stats
.
create_time
;
ref_length
=
m_ref_length
;
}
...
...
@@ -6454,9 +6455,22 @@ void ha_partition::release_auto_increment()
ulonglong
next_auto_inc_val
;
lock_auto_increment
();
next_auto_inc_val
=
ha_data
->
next_auto_inc_val
;
/*
If the current auto_increment values is lower than the reserved
value, and the reserved value was reserved by this thread,
we can lower the reserved value.
*/
if
(
next_insert_id
<
next_auto_inc_val
&&
auto_inc_interval_for_cur_row
.
maximum
()
>=
next_auto_inc_val
)
ha_data
->
next_auto_inc_val
=
next_insert_id
;
{
THD
*
thd
=
ha_thd
();
/*
Check that we do not lower the value because of a failed insert
with SET INSERT_ID, i.e. forced/non generated values.
*/
if
(
thd
->
auto_inc_intervals_forced
.
maximum
()
<
next_insert_id
)
ha_data
->
next_auto_inc_val
=
next_insert_id
;
}
DBUG_PRINT
(
"info"
,
(
"ha_data->next_auto_inc_val: %lu"
,
(
ulong
)
ha_data
->
next_auto_inc_val
));
...
...
sql/item.h
View file @
5fa73f08
...
...
@@ -2320,6 +2320,11 @@ public:
if
(
ref
&&
result_type
()
==
ROW_RESULT
)
(
*
ref
)
->
bring_value
();
}
bool
get_time
(
MYSQL_TIME
*
ltime
)
{
DBUG_ASSERT
(
fixed
);
return
(
*
ref
)
->
get_time
(
ltime
);
}
};
...
...
sql/log.cc
View file @
5fa73f08
...
...
@@ -4679,7 +4679,7 @@ int query_error_code(THD *thd, bool not_killed)
{
int
error
;
if
(
not_killed
)
if
(
not_killed
||
(
thd
->
killed
==
THD
::
KILL_BAD_DATA
)
)
{
error
=
thd
->
is_error
()
?
thd
->
main_da
.
sql_errno
()
:
0
;
...
...
sql/sql_partition.cc
View file @
5fa73f08
...
...
@@ -2876,6 +2876,7 @@ int get_partition_id_range(partition_info *part_info,
*
func_value
=
part_func_value
;
if
(
unsigned_flag
)
part_func_value
-=
0x8000000000000000ULL
;
/* Search for the partition containing part_func_value */
while
(
max_part_id
>
min_part_id
)
{
loc_part_id
=
(
max_part_id
+
min_part_id
)
/
2
;
...
...
@@ -3015,11 +3016,17 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info,
part_end_val
=
range_array
[
loc_part_id
];
if
(
left_endpoint
)
{
DBUG_ASSERT
(
part_func_value
>
part_end_val
?
(
loc_part_id
==
max_partition
&&
!
part_info
->
defined_max_value
)
:
1
);
/*
In case of PARTITION p VALUES LESS THAN MAXVALUE
the maximum value is in the current partition.
the maximum value is in the current (last) partition.
If value is equal or greater than the endpoint,
the range starts from the next partition.
*/
if
(
part_func_value
=
=
part_end_val
&&
if
(
part_func_value
>
=
part_end_val
&&
(
loc_part_id
<
max_partition
||
!
part_info
->
defined_max_value
))
loc_part_id
++
;
}
...
...
@@ -4273,6 +4280,12 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
{
DBUG_ENTER
(
"prep_alter_part_table"
);
/* Foreign keys on partitioned tables are not supported, waits for WL#148 */
if
(
table
->
part_info
&&
(
alter_info
->
flags
&
ALTER_FOREIGN_KEY
))
{
my_error
(
ER_FOREIGN_KEY_ON_PARTITIONED
,
MYF
(
0
));
DBUG_RETURN
(
TRUE
);
}
/*
We are going to manipulate the partition info on the table object
so we need to ensure that the data structure of the table object
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment