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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
92c6bc5e
Commit
92c6bc5e
authored
Mar 31, 2011
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport of bug#11891417 from mysql-trunk to mysql-5.5
parent
d9a3c073
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
467 additions
and
273 deletions
+467
-273
mysql-test/r/partition_error.result
mysql-test/r/partition_error.result
+8
-150
mysql-test/r/partition_myisam.result
mysql-test/r/partition_myisam.result
+241
-0
mysql-test/r/partition_symlink.result
mysql-test/r/partition_symlink.result
+9
-1
mysql-test/t/partition_error.test
mysql-test/t/partition_error.test
+26
-121
mysql-test/t/partition_myisam.test
mysql-test/t/partition_myisam.test
+173
-0
mysql-test/t/partition_symlink.test
mysql-test/t/partition_symlink.test
+10
-1
No files found.
mysql-test/r/partition_error.result
View file @
92c6bc5e
...
@@ -710,95 +710,8 @@ DROP TABLE t1;
...
@@ -710,95 +710,8 @@ DROP TABLE t1;
CREATE TABLE t1 (c TIMESTAMP)
CREATE TABLE t1 (c TIMESTAMP)
PARTITION BY HASH (c) PARTITIONS 4;
PARTITION BY HASH (c) PARTITIONS 4;
ERROR HY000: Field 'c' is of a not allowed type for this type of partitioning
ERROR HY000: Field 'c' is of a not allowed type for this type of partitioning
# Moved to partition_myisam, since it was MyISAM specific
# Added test with existing TIMESTAMP partitioning (when it was allowed).
# Added test with existing TIMESTAMP partitioning (when it was allowed).
CREATE TABLE t1 (a TIMESTAMP)
PARTITION BY HASH (UNIX_TIMESTAMP(a));
INSERT INTO t1 VALUES ('2000-01-02 03:04:05');
SELECT * FROM t1;
a
2000-01-02 03:04:05
FLUSH TABLES;
# replacing t1.frm with TO_DAYS(a) which was allowed earlier.
# Disable warnings, since the result would differ when running with
# --ps-protocol (only for the 'SELECT * FROM t1' statement).
SELECT * FROM t1;
a
2000-01-02 03:04:05
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (TO_DAYS(a)) */
INSERT INTO t1 VALUES ('2001-02-03 04:05:06');
SELECT * FROM t1;
a
2000-01-02 03:04:05
2001-02-03 04:05:06
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
Warnings:
Warning 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE t1
PARTITION BY RANGE (TO_DAYS(a))
(PARTITION p0 VALUES LESS THAN (10000),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (TO_DAYS(a))
PARTITIONS 3 */
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (TO_DAYS(a))
PARTITIONS 3 */
Warnings:
Warning 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
DROP TABLE t2;
CREATE TABLE t2 SELECT * FROM t1;
DROP TABLE t2;
ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (UNIX_TIMESTAMP(a)) */
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (UNIX_TIMESTAMP(a))
PARTITIONS 3 */
SELECT * FROM t1;
a
2000-01-02 03:04:05
2001-02-03 04:05:06
DROP TABLE t1;
#
# Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
#
CREATE TABLE t1 (a INT) PARTITION BY HASH (a);
FLUSH TABLES;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Error Failed to read from the .par file
test.t1 check Error Incorrect information in file: './test/t1.frm'
test.t1 check error Corrupt
SELECT * FROM t1;
ERROR HY000: Failed to read from the .par file
# Note that it is currently impossible to drop a partitioned table
# without the .par file
DROP TABLE t1;
ERROR 42S02: Unknown table 't1'
#
#
# Bug#49477: Assertion `0' failed in ha_partition.cc:5530
# Bug#49477: Assertion `0' failed in ha_partition.cc:5530
# with temporary table and partitions
# with temporary table and partitions
...
@@ -831,10 +744,10 @@ Table Create Table
...
@@ -831,10 +744,10 @@ Table Create Table
t1 CREATE TABLE `t1` (
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`id` int(11) DEFAULT NULL,
`purchased` date DEFAULT NULL
`purchased` date DEFAULT NULL
) ENGINE=
MyISAM
DEFAULT CHARSET=latin1
) ENGINE=
<curr_engine>
DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (YEAR(purchased))
/*!50100 PARTITION BY RANGE (YEAR(purchased))
SUBPARTITION BY HASH (TO_DAYS(purchased))
SUBPARTITION BY HASH (TO_DAYS(purchased))
(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE =
MyISAM
) */
(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE =
<curr_engine>
) */
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (id INT, purchased DATE)
CREATE TABLE t1 (id INT, purchased DATE)
PARTITION BY RANGE(YEAR(purchased))
PARTITION BY RANGE(YEAR(purchased))
...
@@ -852,12 +765,12 @@ Table Create Table
...
@@ -852,12 +765,12 @@ Table Create Table
t1 CREATE TABLE `t1` (
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`id` int(11) DEFAULT NULL,
`purchased` date DEFAULT NULL
`purchased` date DEFAULT NULL
) ENGINE=
MyISAM
DEFAULT CHARSET=latin1
) ENGINE=
<curr_engine>
DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (YEAR(purchased))
/*!50100 PARTITION BY RANGE (YEAR(purchased))
SUBPARTITION BY HASH (TO_DAYS(purchased))
SUBPARTITION BY HASH (TO_DAYS(purchased))
(PARTITION p0 VALUES LESS THAN MAXVALUE
(PARTITION p0 VALUES LESS THAN MAXVALUE
(SUBPARTITION sp0 ENGINE =
MyISAM
,
(SUBPARTITION sp0 ENGINE =
<curr_engine>
,
SUBPARTITION sp1 ENGINE =
MyISAM
)) */
SUBPARTITION sp1 ENGINE =
<curr_engine>
)) */
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (id INT, purchased DATE)
CREATE TABLE t1 (id INT, purchased DATE)
PARTITION BY RANGE(YEAR(purchased))
PARTITION BY RANGE(YEAR(purchased))
...
@@ -872,53 +785,11 @@ Table Create Table
...
@@ -872,53 +785,11 @@ Table Create Table
t1 CREATE TABLE `t1` (
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`id` int(11) DEFAULT NULL,
`purchased` date DEFAULT NULL
`purchased` date DEFAULT NULL
) ENGINE=
MyISAM
DEFAULT CHARSET=latin1
) ENGINE=
<curr_engine>
DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (YEAR(purchased))
/*!50100 PARTITION BY RANGE (YEAR(purchased))
(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE =
MyISAM
) */
(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE =
<curr_engine>
) */
DROP TABLE t1;
DROP TABLE t1;
SET @@sql_mode= @org_mode;
SET @@sql_mode= @org_mode;
#
# 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));
CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a));
INSERT INTO t1 VALUES (1),(1);
INSERT INTO t1 VALUES (1),(1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
...
@@ -928,19 +799,6 @@ PARTITION BY KEY (a) PARTITIONS 2;
...
@@ -928,19 +799,6 @@ PARTITION BY KEY (a) PARTITIONS 2;
INSERT INTO t1 VALUES (1),(1);
INSERT INTO t1 VALUES (1),(1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (a INT)
PARTITION BY HASH (a)
( PARTITION p0 ENGINE=MyISAM,
PARTITION p1);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
CREATE TABLE t1 (a INT)
PARTITION BY LIST (a)
SUBPARTITION BY HASH (a)
( PARTITION p0 VALUES IN (0)
( SUBPARTITION s0, SUBPARTITION s1 ENGINE=MyISAM, SUBPARTITION s2),
PARTITION p1 VALUES IN (1)
( SUBPARTITION s3 ENGINE=MyISAM, SUBPARTITION s4, SUBPARTITION s5 ENGINE=MyISAM));
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
CREATE TABLE t1 (
CREATE TABLE t1 (
a int
a int
)
)
...
...
mysql-test/r/partition_
not_embedded
.result
→
mysql-test/r/partition_
myisam
.result
View file @
92c6bc5e
DROP TABLE IF EXISTS t1, t2;
DROP TABLE IF EXISTS t1, t2;
#
# Bug#50036: Inconsistent errors when using TIMESTAMP
# columns/expressions
# Added test with existing TIMESTAMP partitioning (when it was allowed).
CREATE TABLE t1 (a TIMESTAMP)
ENGINE = MyISAM
PARTITION BY HASH (UNIX_TIMESTAMP(a));
INSERT INTO t1 VALUES ('2000-01-02 03:04:05');
SELECT * FROM t1;
a
2000-01-02 03:04:05
FLUSH TABLES;
# replacing t1.frm with TO_DAYS(a) which was allowed earlier.
# Disable warnings, since the result would differ when running with
# --ps-protocol (only for the 'SELECT * FROM t1' statement).
SELECT * FROM t1;
a
2000-01-02 03:04:05
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=<curr_engine> DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (TO_DAYS(a)) */
INSERT INTO t1 VALUES ('2001-02-03 04:05:06');
SELECT * FROM t1;
a
2000-01-02 03:04:05
2001-02-03 04:05:06
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
Warnings:
Warning 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
ALTER TABLE t1
PARTITION BY RANGE (TO_DAYS(a))
(PARTITION p0 VALUES LESS THAN (10000),
PARTITION p1 VALUES LESS THAN (MAXVALUE));
ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (TO_DAYS(a))
PARTITIONS 3 */
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (TO_DAYS(a))
PARTITIONS 3 */
Warnings:
Warning 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
DROP TABLE t2;
CREATE TABLE t2 SELECT * FROM t1;
DROP TABLE t2;
ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (UNIX_TIMESTAMP(a)) */
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (UNIX_TIMESTAMP(a))
PARTITIONS 3 */
SELECT * FROM t1;
a
2000-01-02 03:04:05
2001-02-03 04:05:06
DROP TABLE t1;
#
# Bug#31931: Mix of handlers error message
#
CREATE TABLE t1 (a INT)
PARTITION BY HASH (a)
( PARTITION p0 ENGINE=MyISAM,
PARTITION p1);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
CREATE TABLE t1 (a INT)
PARTITION BY LIST (a)
SUBPARTITION BY HASH (a)
( PARTITION p0 VALUES IN (0)
( SUBPARTITION s0, SUBPARTITION s1 ENGINE=MyISAM, SUBPARTITION s2),
PARTITION p1 VALUES IN (1)
( SUBPARTITION s3 ENGINE=MyISAM, SUBPARTITION s4, SUBPARTITION s5 ENGINE=MyISAM));
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
#
# Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
#
CREATE TABLE t1 (a INT)
ENGINE = MyISAM
PARTITION BY HASH (a);
FLUSH TABLES;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Error Failed to read from the .par file
test.t1 check Error Incorrect information in file: './test/t1.frm'
test.t1 check error Corrupt
SELECT * FROM t1;
ERROR HY000: Failed to read from the .par file
# Note that it is currently impossible to drop a partitioned table
# without the .par file
DROP TABLE t1;
ERROR 42S02: Unknown table '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)
ENGINE = MyISAM;
SET INSERT_ID= 13;
INSERT INTO t1 VALUES (NULL);
SET INSERT_ID= 12;
# For transactional engines, 12 will not be inserted, since the failing
# statement is rolled back.
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);
# NOTE: 12 exists only in non transactional engines!
SELECT * FROM t1;
a
12
13
14
DROP TABLE t1;
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY)
ENGINE = MyISAM
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;
# Bug#30102 test
# Bug#30102 test
CREATE TABLE t1 (a INT)
CREATE TABLE t1 (a INT)
ENGINE = MyISAM
PARTITION BY RANGE (a)
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (6),
(PARTITION p0 VALUES LESS THAN (6),
PARTITION `p1....................` VALUES LESS THAN (9),
PARTITION `p1....................` VALUES LESS THAN (9),
...
...
mysql-test/r/partition_symlink.result
View file @
92c6bc5e
...
@@ -6,11 +6,12 @@ DROP DATABASE IF EXISTS mysqltest2;
...
@@ -6,11 +6,12 @@ DROP DATABASE IF EXISTS mysqltest2;
CREATE USER mysqltest_1@localhost;
CREATE USER mysqltest_1@localhost;
CREATE DATABASE mysqltest2;
CREATE DATABASE mysqltest2;
USE mysqltest2;
USE mysqltest2;
CREATE TABLE t1 (a INT);
CREATE TABLE t1 (a INT)
ENGINE = MyISAM
;
INSERT INTO t1 VALUES (0);
INSERT INTO t1 VALUES (0);
# user mysqltest_1:
# user mysqltest_1:
USE test;
USE test;
CREATE TABLE t1 (a INT)
CREATE TABLE t1 (a INT)
ENGINE = MyISAM
PARTITION BY LIST (a) (
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
PARTITION p0 VALUES IN (0)
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
...
@@ -47,6 +48,7 @@ DROP DATABASE mysqltest2;
...
@@ -47,6 +48,7 @@ DROP DATABASE mysqltest2;
CREATE DATABASE mysqltest2;
CREATE DATABASE mysqltest2;
USE mysqltest2;
USE mysqltest2;
CREATE TABLE t1 (a INT)
CREATE TABLE t1 (a INT)
ENGINE = MyISAM
PARTITION BY LIST (a) (
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
PARTITION p0 VALUES IN (0)
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
...
@@ -58,6 +60,7 @@ DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
...
@@ -58,6 +60,7 @@ DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
# user mysqltest_1:
# user mysqltest_1:
USE test;
USE test;
CREATE TABLE t1 (a INT)
CREATE TABLE t1 (a INT)
ENGINE = MyISAM
PARTITION BY LIST (a) (
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
PARTITION p0 VALUES IN (0)
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
...
@@ -68,6 +71,7 @@ DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
...
@@ -68,6 +71,7 @@ DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
);
);
Got one of the listed errors
Got one of the listed errors
CREATE TABLE t1 (a INT)
CREATE TABLE t1 (a INT)
ENGINE = MyISAM
PARTITION BY LIST (a) (
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
PARTITION p0 VALUES IN (0)
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
...
@@ -82,6 +86,7 @@ DROP DATABASE mysqltest2;
...
@@ -82,6 +86,7 @@ DROP DATABASE mysqltest2;
USE test;
USE test;
DROP USER mysqltest_1@localhost;
DROP USER mysqltest_1@localhost;
create table t2 (i int )
create table t2 (i int )
ENGINE = MyISAM
partition by range (i)
partition by range (i)
(
(
partition p01 values less than (1000)
partition p01 values less than (1000)
...
@@ -94,6 +99,7 @@ select @@sql_mode;
...
@@ -94,6 +99,7 @@ select @@sql_mode;
@@sql_mode
@@sql_mode
NO_DIR_IN_CREATE
NO_DIR_IN_CREATE
create table t1 (i int )
create table t1 (i int )
ENGINE = MyISAM
partition by range (i)
partition by range (i)
(
(
partition p01 values less than (1000)
partition p01 values less than (1000)
...
@@ -113,10 +119,12 @@ t2 CREATE TABLE `t2` (
...
@@ -113,10 +119,12 @@ t2 CREATE TABLE `t2` (
DROP TABLE t1, t2;
DROP TABLE t1, t2;
set @@sql_mode=@org_mode;
set @@sql_mode=@org_mode;
create table t1 (a int)
create table t1 (a int)
ENGINE = MyISAM
partition by key (a)
partition by key (a)
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
Got one of the listed errors
Got one of the listed errors
create table t1 (a int)
create table t1 (a int)
ENGINE = MyISAM
partition by key (a)
partition by key (a)
(partition p0,
(partition p0,
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
...
...
mysql-test/t/partition_error.test
View file @
92c6bc5e
...
@@ -741,65 +741,9 @@ DROP TABLE t1;
...
@@ -741,65 +741,9 @@ DROP TABLE t1;
CREATE
TABLE
t1
(
c
TIMESTAMP
)
CREATE
TABLE
t1
(
c
TIMESTAMP
)
PARTITION
BY
HASH
(
c
)
PARTITIONS
4
;
PARTITION
BY
HASH
(
c
)
PARTITIONS
4
;
--
echo
# Moved to partition_myisam, since it was MyISAM specific
--
echo
# Added test with existing TIMESTAMP partitioning (when it was allowed).
--
echo
# Added test with existing TIMESTAMP partitioning (when it was allowed).
CREATE
TABLE
t1
(
a
TIMESTAMP
)
PARTITION
BY
HASH
(
UNIX_TIMESTAMP
(
a
));
INSERT
INTO
t1
VALUES
(
'2000-01-02 03:04:05'
);
--
sorted_result
SELECT
*
FROM
t1
;
FLUSH
TABLES
;
--
echo
# replacing t1.frm with TO_DAYS(a) which was allowed earlier.
--
remove_file
$MYSQLD_DATADIR
/
test
/
t1
.
frm
--
copy_file
std_data
/
parts
/
t1TIMESTAMP
.
frm
$MYSQLD_DATADIR
/
test
/
t1
.
frm
--
echo
# Disable warnings, since the result would differ when running with
--
echo
# --ps-protocol (only for the 'SELECT * FROM t1' statement).
--
disable_warnings
--
sorted_result
SELECT
*
FROM
t1
;
--
enable_warnings
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
VALUES
(
'2001-02-03 04:05:06'
);
--
sorted_result
SELECT
*
FROM
t1
;
ALTER
TABLE
t1
ADD
PARTITION
PARTITIONS
2
;
--
error
ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER
TABLE
t1
PARTITION
BY
RANGE
(
TO_DAYS
(
a
))
(
PARTITION
p0
VALUES
LESS
THAN
(
10000
),
PARTITION
p1
VALUES
LESS
THAN
(
MAXVALUE
));
SHOW
CREATE
TABLE
t1
;
CREATE
TABLE
t2
LIKE
t1
;
SHOW
CREATE
TABLE
t2
;
DROP
TABLE
t2
;
CREATE
TABLE
t2
SELECT
*
FROM
t1
;
DROP
TABLE
t2
;
ALTER
TABLE
t1
PARTITION
BY
HASH
(
UNIX_TIMESTAMP
(
a
));
SHOW
CREATE
TABLE
t1
;
ALTER
TABLE
t1
ADD
PARTITION
PARTITIONS
2
;
SHOW
CREATE
TABLE
t1
;
--
sorted_result
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
--
echo
#
CREATE
TABLE
t1
(
a
INT
)
PARTITION
BY
HASH
(
a
);
FLUSH
TABLES
;
--
remove_file
$MYSQLD_DATADIR
/
test
/
t1
.
par
--
replace_result
$MYSQLD_DATADIR
./
CHECK
TABLE
t1
;
--
error
ER_FAILED_READ_FROM_PAR_FILE
SELECT
*
FROM
t1
;
--
echo
# Note that it is currently impossible to drop a partitioned table
--
echo
# without the .par file
--
error
ER_BAD_TABLE_ERROR
DROP
TABLE
t1
;
--
remove_file
$MYSQLD_DATADIR
/
test
/
t1
.
frm
--
remove_file
$MYSQLD_DATADIR
/
test
/
t1
#P#p0.MYI
--
remove_file
$MYSQLD_DATADIR
/
test
/
t1
#P#p0.MYD
--
echo
#
--
echo
#
--
echo
# Bug#49477: Assertion `0' failed in ha_partition.cc:5530
--
echo
# Bug#49477: Assertion `0' failed in ha_partition.cc:5530
--
echo
# with temporary table and partitions
--
echo
# with temporary table and partitions
...
@@ -820,6 +764,7 @@ SUBPARTITION BY HASH(TO_DAYS(purchased))
...
@@ -820,6 +764,7 @@ SUBPARTITION BY HASH(TO_DAYS(purchased))
(
PARTITION
p0
VALUES
LESS
THAN
MAXVALUE
(
PARTITION
p0
VALUES
LESS
THAN
MAXVALUE
DATA
DIRECTORY
=
'/tmp/not-existing'
DATA
DIRECTORY
=
'/tmp/not-existing'
INDEX
DIRECTORY
=
'/tmp/not-existing'
);
INDEX
DIRECTORY
=
'/tmp/not-existing'
);
--
replace_result
MyISAM
<
curr_engine
>
InnoDB
<
curr_engine
>
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
id
INT
,
purchased
DATE
)
CREATE
TABLE
t1
(
id
INT
,
purchased
DATE
)
...
@@ -830,6 +775,7 @@ SUBPARTITION BY HASH(TO_DAYS(purchased)) SUBPARTITIONS 2
...
@@ -830,6 +775,7 @@ SUBPARTITION BY HASH(TO_DAYS(purchased)) SUBPARTITIONS 2
DATA
DIRECTORY
=
'/tmp/not-existing'
DATA
DIRECTORY
=
'/tmp/not-existing'
INDEX
DIRECTORY
=
'/tmp/not-existing'
,
INDEX
DIRECTORY
=
'/tmp/not-existing'
,
SUBPARTITION
sp1
));
SUBPARTITION
sp1
));
--
replace_result
MyISAM
<
curr_engine
>
InnoDB
<
curr_engine
>
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
id
INT
,
purchased
DATE
)
CREATE
TABLE
t1
(
id
INT
,
purchased
DATE
)
...
@@ -837,34 +783,11 @@ PARTITION BY RANGE(YEAR(purchased))
...
@@ -837,34 +783,11 @@ PARTITION BY RANGE(YEAR(purchased))
(
PARTITION
p0
VALUES
LESS
THAN
MAXVALUE
(
PARTITION
p0
VALUES
LESS
THAN
MAXVALUE
DATA
DIRECTORY
=
'/tmp/not-existing'
DATA
DIRECTORY
=
'/tmp/not-existing'
INDEX
DIRECTORY
=
'/tmp/not-existing'
);
INDEX
DIRECTORY
=
'/tmp/not-existing'
);
--
replace_result
MyISAM
<
curr_engine
>
InnoDB
<
curr_engine
>
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
SET
@@
sql_mode
=
@
org_mode
;
SET
@@
sql_mode
=
@
org_mode
;
--
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
# Bug#38719: Partitioning returns a different error code for a
# duplicate key error
# duplicate key error
...
@@ -878,24 +801,6 @@ PARTITION BY KEY (a) PARTITIONS 2;
...
@@ -878,24 +801,6 @@ PARTITION BY KEY (a) PARTITIONS 2;
INSERT
INTO
t1
VALUES
(
1
),(
1
);
INSERT
INTO
t1
VALUES
(
1
),(
1
);
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# Bug#31931: Mix of handlers error message
#
--
error
ER_MIX_HANDLER_ERROR
CREATE
TABLE
t1
(
a
INT
)
PARTITION
BY
HASH
(
a
)
(
PARTITION
p0
ENGINE
=
MyISAM
,
PARTITION
p1
);
--
error
ER_MIX_HANDLER_ERROR
CREATE
TABLE
t1
(
a
INT
)
PARTITION
BY
LIST
(
a
)
SUBPARTITION
BY
HASH
(
a
)
(
PARTITION
p0
VALUES
IN
(
0
)
(
SUBPARTITION
s0
,
SUBPARTITION
s1
ENGINE
=
MyISAM
,
SUBPARTITION
s2
),
PARTITION
p1
VALUES
IN
(
1
)
(
SUBPARTITION
s3
ENGINE
=
MyISAM
,
SUBPARTITION
s4
,
SUBPARTITION
s5
ENGINE
=
MyISAM
));
#
#
# Bug 29368:
# Bug 29368:
# Incorrect error, 1467, for syntax error when creating partition
# Incorrect error, 1467, for syntax error when creating partition
...
@@ -912,7 +817,7 @@ PARTITION BY RANGE (a)
...
@@ -912,7 +817,7 @@ PARTITION BY RANGE (a)
#
#
# Partition by key stand-alone error
# Partition by key stand-alone error
#
#
--
error
1064
--
error
ER_PARSE_ERROR
partition
by
list
(
a
)
partition
by
list
(
a
)
partitions
3
partitions
3
(
partition
x1
values
in
(
1
,
2
,
9
,
4
)
tablespace
ts1
,
(
partition
x1
values
in
(
1
,
2
,
9
,
4
)
tablespace
ts1
,
...
@@ -949,7 +854,7 @@ partitions 3
...
@@ -949,7 +854,7 @@ partitions 3
#
#
# Partition by key, partition function not allowed
# Partition by key, partition function not allowed
#
#
--
error
1064
--
error
ER_PARSE_ERROR
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
int
not
null
,
a
int
not
null
,
b
int
not
null
,
b
int
not
null
,
...
@@ -964,7 +869,7 @@ partitions 3
...
@@ -964,7 +869,7 @@ partitions 3
#
#
# Partition by key, no partition name
# Partition by key, no partition name
#
#
--
error
1064
--
error
ER_PARSE_ERROR
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
int
not
null
,
a
int
not
null
,
b
int
not
null
,
b
int
not
null
,
...
@@ -995,7 +900,7 @@ select load_file('$MYSQLD_DATADIR/test/t1.par');
...
@@ -995,7 +900,7 @@ select load_file('$MYSQLD_DATADIR/test/t1.par');
#
#
# Partition by hash, invalid field in function
# Partition by hash, invalid field in function
#
#
--
error
1054
--
error
ER_BAD_FIELD_ERROR
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
int
not
null
,
a
int
not
null
,
b
int
not
null
,
b
int
not
null
,
...
@@ -1025,7 +930,7 @@ partitions 3
...
@@ -1025,7 +930,7 @@ partitions 3
#
#
# Partition by key specified 3 partitions but only defined 2 => error
# Partition by key specified 3 partitions but only defined 2 => error
#
#
--
error
1064
--
error
ER_PARSE_ERROR
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
int
not
null
,
a
int
not
null
,
b
int
not
null
,
b
int
not
null
,
...
@@ -1038,7 +943,7 @@ partitions 3
...
@@ -1038,7 +943,7 @@ partitions 3
#
#
# Partition by hash, random function
# Partition by hash, random function
#
#
--
error
1064
--
error
ER_PARSE_ERROR
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
int
not
null
,
a
int
not
null
,
b
int
not
null
,
b
int
not
null
,
...
@@ -1051,7 +956,7 @@ partitions 2
...
@@ -1051,7 +956,7 @@ partitions 2
#
#
# Partition by range, random function
# Partition by range, random function
#
#
--
error
1064
--
error
ER_PARSE_ERROR
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
int
not
null
,
a
int
not
null
,
b
int
not
null
,
b
int
not
null
,
...
@@ -1064,7 +969,7 @@ partitions 2
...
@@ -1064,7 +969,7 @@ partitions 2
#
#
# Partition by list, random function
# Partition by list, random function
#
#
--
error
1064
--
error
ER_PARSE_ERROR
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
int
not
null
,
a
int
not
null
,
b
int
not
null
,
b
int
not
null
,
...
@@ -1200,7 +1105,7 @@ select load_file('$MYSQLD_DATADIR/test/t1.par');
...
@@ -1200,7 +1105,7 @@ select load_file('$MYSQLD_DATADIR/test/t1.par');
#
#
# Subpartition by hash, no partitions defined, wrong subpartition function
# Subpartition by hash, no partitions defined, wrong subpartition function
#
#
--
error
1064
--
error
ER_PARSE_ERROR
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
int
not
null
,
a
int
not
null
,
b
int
not
null
,
b
int
not
null
,
...
@@ -1227,7 +1132,7 @@ select load_file('$MYSQLD_DATADIR/test/t1.par');
...
@@ -1227,7 +1132,7 @@ select load_file('$MYSQLD_DATADIR/test/t1.par');
#
#
# Subpartition by hash, no partitions defined, wrong subpartition function
# Subpartition by hash, no partitions defined, wrong subpartition function
#
#
--
error
1064
--
error
ER_PARSE_ERROR
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
int
not
null
,
a
int
not
null
,
b
int
not
null
,
b
int
not
null
,
...
@@ -1268,7 +1173,7 @@ subpartition by hash (3+4);
...
@@ -1268,7 +1173,7 @@ subpartition by hash (3+4);
#
#
# Subpartition by hash, no partitions defined, wrong subpartition function
# Subpartition by hash, no partitions defined, wrong subpartition function
#
#
--
error
1054
--
error
ER_BAD_FIELD_ERROR
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
int
not
null
,
a
int
not
null
,
b
int
not
null
,
b
int
not
null
,
...
@@ -1294,7 +1199,7 @@ select load_file('$MYSQLD_DATADIR/test/t1.par');
...
@@ -1294,7 +1199,7 @@ select load_file('$MYSQLD_DATADIR/test/t1.par');
#
#
# Partition by range, invalid field in function
# Partition by range, invalid field in function
#
#
--
error
1054
--
error
ER_BAD_FIELD_ERROR
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
int
not
null
,
a
int
not
null
,
b
int
not
null
,
b
int
not
null
,
...
@@ -1448,7 +1353,7 @@ partitions 2
...
@@ -1448,7 +1353,7 @@ partitions 2
#
#
# Subpartition by hash, wrong number of subpartitions
# Subpartition by hash, wrong number of subpartitions
#
#
--
error
1064
--
error
ER_PARSE_ERROR
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
int
not
null
,
a
int
not
null
,
b
int
not
null
,
b
int
not
null
,
...
@@ -1468,7 +1373,7 @@ subpartitions 3
...
@@ -1468,7 +1373,7 @@ subpartitions 3
#
#
# Subpartition by hash, wrong number of subpartitions
# Subpartition by hash, wrong number of subpartitions
#
#
--
error
1064
--
error
ER_PARSE_ERROR
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
int
not
null
,
a
int
not
null
,
b
int
not
null
,
b
int
not
null
,
...
@@ -1488,7 +1393,7 @@ subpartition by hash (a+b)
...
@@ -1488,7 +1393,7 @@ subpartition by hash (a+b)
#
#
# Subpartition by list => error
# Subpartition by list => error
#
#
--
error
1064
--
error
ER_PARSE_ERROR
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
int
not
null
,
a
int
not
null
,
b
int
not
null
,
b
int
not
null
,
...
@@ -1507,7 +1412,7 @@ subpartition by list (a+b)
...
@@ -1507,7 +1412,7 @@ subpartition by list (a+b)
#
#
# Subpartition by list => error
# Subpartition by list => error
#
#
--
error
1064
--
error
ER_PARSE_ERROR
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
int
not
null
,
a
int
not
null
,
b
int
not
null
,
b
int
not
null
,
...
@@ -1551,7 +1456,7 @@ partitions 2
...
@@ -1551,7 +1456,7 @@ partitions 2
#
#
# Partition by list, invalid field in function
# Partition by list, invalid field in function
#
#
--
error
1054
--
error
ER_BAD_FIELD_ERROR
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
int
not
null
,
a
int
not
null
,
b
int
not
null
,
b
int
not
null
,
...
@@ -1635,7 +1540,7 @@ partitions 2
...
@@ -1635,7 +1540,7 @@ partitions 2
#
#
# Partition by list, missing parenthesis
# Partition by list, missing parenthesis
#
#
--
error
1064
--
error
ER_PARSE_ERROR
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
a
int
not
null
,
a
int
not
null
,
b
int
not
null
,
b
int
not
null
,
...
@@ -1649,7 +1554,7 @@ partitions 2
...
@@ -1649,7 +1554,7 @@ partitions 2
#
#
# Bug #13439: Crash when LESS THAN (non-literal)
# Bug #13439: Crash when LESS THAN (non-literal)
#
#
--
error
1054
--
error
ER_BAD_FIELD_ERROR
CREATE
TABLE
t1
(
a
int
)
CREATE
TABLE
t1
(
a
int
)
PARTITION
BY
RANGE
(
a
)
PARTITION
BY
RANGE
(
a
)
(
PARTITION
p0
VALUES
LESS
THAN
(
x1
));
(
PARTITION
p0
VALUES
LESS
THAN
(
x1
));
...
@@ -1676,13 +1581,13 @@ partition by range (ascii(v))
...
@@ -1676,13 +1581,13 @@ partition by range (ascii(v))
(
partition
p0
values
less
than
(
10
));
(
partition
p0
values
less
than
(
10
));
#drop table t1;
#drop table t1;
--
error
1064
--
error
ER_PARSE_ERROR
create
table
t1
(
a
int
)
create
table
t1
(
a
int
)
partition
by
hash
(
rand
(
a
));
partition
by
hash
(
rand
(
a
));
--
error
1064
--
error
ER_PARSE_ERROR
create
table
t1
(
a
int
)
create
table
t1
(
a
int
)
partition
by
hash
(
CURTIME
()
+
a
);
partition
by
hash
(
CURTIME
()
+
a
);
--
error
1064
--
error
ER_PARSE_ERROR
create
table
t1
(
a
int
)
create
table
t1
(
a
int
)
partition
by
hash
(
NOW
()
+
a
);
partition
by
hash
(
NOW
()
+
a
);
--
error
ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
--
error
ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
...
...
mysql-test/t/partition_
not_embedded
.test
→
mysql-test/t/partition_
myisam
.test
View file @
92c6bc5e
--
source
include
/
have_partition
.
inc
--
source
include
/
have_partition
.
inc
--
source
include
/
not_embedded
.
inc
--
disable_warnings
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
,
t2
;
DROP
TABLE
IF
EXISTS
t1
,
t2
;
--
enable_warnings
--
enable_warnings
# These tests is only useful when running on MyISAM,
# due to DATA/INDEX directory, non transactional behavior, tests with MyISAM
# files etc.
let
$MYSQLD_DATADIR
=
`SELECT @@datadir`
;
let
$MYSQLD_DATADIR
=
`SELECT @@datadir`
;
--
echo
#
--
echo
# Bug#50036: Inconsistent errors when using TIMESTAMP
--
echo
# columns/expressions
--
echo
# Added test with existing TIMESTAMP partitioning (when it was allowed).
CREATE
TABLE
t1
(
a
TIMESTAMP
)
ENGINE
=
MyISAM
PARTITION
BY
HASH
(
UNIX_TIMESTAMP
(
a
));
INSERT
INTO
t1
VALUES
(
'2000-01-02 03:04:05'
);
--
sorted_result
SELECT
*
FROM
t1
;
FLUSH
TABLES
;
--
echo
# replacing t1.frm with TO_DAYS(a) which was allowed earlier.
--
remove_file
$MYSQLD_DATADIR
/
test
/
t1
.
frm
--
copy_file
std_data
/
parts
/
t1TIMESTAMP
.
frm
$MYSQLD_DATADIR
/
test
/
t1
.
frm
--
echo
# Disable warnings, since the result would differ when running with
--
echo
# --ps-protocol (only for the 'SELECT * FROM t1' statement).
--
disable_warnings
--
sorted_result
SELECT
*
FROM
t1
;
--
enable_warnings
--
replace_result
MyISAM
<
curr_engine
>
InnoDB
<
curr_engine
>
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
VALUES
(
'2001-02-03 04:05:06'
);
--
sorted_result
SELECT
*
FROM
t1
;
ALTER
TABLE
t1
ADD
PARTITION
PARTITIONS
2
;
--
error
ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
ALTER
TABLE
t1
PARTITION
BY
RANGE
(
TO_DAYS
(
a
))
(
PARTITION
p0
VALUES
LESS
THAN
(
10000
),
PARTITION
p1
VALUES
LESS
THAN
(
MAXVALUE
));
SHOW
CREATE
TABLE
t1
;
CREATE
TABLE
t2
LIKE
t1
;
SHOW
CREATE
TABLE
t2
;
DROP
TABLE
t2
;
CREATE
TABLE
t2
SELECT
*
FROM
t1
;
DROP
TABLE
t2
;
ALTER
TABLE
t1
PARTITION
BY
HASH
(
UNIX_TIMESTAMP
(
a
));
SHOW
CREATE
TABLE
t1
;
ALTER
TABLE
t1
ADD
PARTITION
PARTITIONS
2
;
SHOW
CREATE
TABLE
t1
;
--
sorted_result
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug#31931: Mix of handlers error message
--
echo
#
--
error
ER_MIX_HANDLER_ERROR
CREATE
TABLE
t1
(
a
INT
)
PARTITION
BY
HASH
(
a
)
(
PARTITION
p0
ENGINE
=
MyISAM
,
PARTITION
p1
);
--
error
ER_MIX_HANDLER_ERROR
CREATE
TABLE
t1
(
a
INT
)
PARTITION
BY
LIST
(
a
)
SUBPARTITION
BY
HASH
(
a
)
(
PARTITION
p0
VALUES
IN
(
0
)
(
SUBPARTITION
s0
,
SUBPARTITION
s1
ENGINE
=
MyISAM
,
SUBPARTITION
s2
),
PARTITION
p1
VALUES
IN
(
1
)
(
SUBPARTITION
s3
ENGINE
=
MyISAM
,
SUBPARTITION
s4
,
SUBPARTITION
s5
ENGINE
=
MyISAM
));
--
echo
#
--
echo
# Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
--
echo
#
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
MyISAM
PARTITION
BY
HASH
(
a
);
FLUSH
TABLES
;
--
remove_file
$MYSQLD_DATADIR
/
test
/
t1
.
par
--
replace_result
$MYSQLD_DATADIR
./
CHECK
TABLE
t1
;
--
error
ER_FAILED_READ_FROM_PAR_FILE
SELECT
*
FROM
t1
;
--
echo
# Note that it is currently impossible to drop a partitioned table
--
echo
# without the .par file
--
error
ER_BAD_TABLE_ERROR
DROP
TABLE
t1
;
--
remove_file
$MYSQLD_DATADIR
/
test
/
t1
.
frm
--
remove_file
$MYSQLD_DATADIR
/
test
/
t1
#P#p0.MYI
--
remove_file
$MYSQLD_DATADIR
/
test
/
t1
#P#p0.MYD
--
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
)
ENGINE
=
MyISAM
;
SET
INSERT_ID
=
13
;
INSERT
INTO
t1
VALUES
(
NULL
);
SET
INSERT_ID
=
12
;
--
echo
# For transactional engines, 12 will not be inserted, since the failing
--
echo
# statement is rolled back.
--
error
ER_DUP_ENTRY
INSERT
INTO
t1
VALUES
(
NULL
),
(
NULL
),
(
NULL
);
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
VALUES
(
NULL
);
--
echo
# NOTE: 12 exists only in non transactional engines!
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
INT
AUTO_INCREMENT
PRIMARY
KEY
)
ENGINE
=
MyISAM
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#30102: rename table does corrupt tables with partition files on failure
# Bug#30102: rename table does corrupt tables with partition files on failure
#
#
--
echo
# Bug#30102 test
--
echo
# Bug#30102 test
CREATE
TABLE
t1
(
a
INT
)
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
MyISAM
PARTITION
BY
RANGE
(
a
)
PARTITION
BY
RANGE
(
a
)
(
PARTITION
p0
VALUES
LESS
THAN
(
6
),
(
PARTITION
p0
VALUES
LESS
THAN
(
6
),
PARTITION
`p1....................`
VALUES
LESS
THAN
(
9
),
PARTITION
`p1....................`
VALUES
LESS
THAN
(
9
),
...
...
mysql-test/t/partition_symlink.test
View file @
92c6bc5e
# Test that must have symlink. eg. using DATA/INDEX DIR
# Test that must have symlink. eg. using DATA/INDEX DIR
# (DATA/INDEX DIR requires symlinks)
# (DATA/INDEX DIR requires symlinks)
# This test is only useful for MyISAM, since no other engine supports DATA DIR
--
source
include
/
have_partition
.
inc
--
source
include
/
have_partition
.
inc
--
source
include
/
have_symlink
.
inc
--
source
include
/
have_symlink
.
inc
# remove the not_windows line after fixing bug#33687
# remove the not_windows line after fixing bug#33687
...
@@ -33,13 +34,14 @@ DROP DATABASE IF EXISTS mysqltest2;
...
@@ -33,13 +34,14 @@ DROP DATABASE IF EXISTS mysqltest2;
CREATE
USER
mysqltest_1
@
localhost
;
CREATE
USER
mysqltest_1
@
localhost
;
CREATE
DATABASE
mysqltest2
;
CREATE
DATABASE
mysqltest2
;
USE
mysqltest2
;
USE
mysqltest2
;
CREATE
TABLE
t1
(
a
INT
);
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
0
);
INSERT
INTO
t1
VALUES
(
0
);
connect
(
con1
,
localhost
,
mysqltest_1
,,);
connect
(
con1
,
localhost
,
mysqltest_1
,,);
--
echo
# user mysqltest_1:
--
echo
# user mysqltest_1:
USE
test
;
USE
test
;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
eval
CREATE
TABLE
t1
(
a
INT
)
eval
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
MyISAM
PARTITION
BY
LIST
(
a
)
(
PARTITION
BY
LIST
(
a
)
(
PARTITION
p0
VALUES
IN
(
0
)
PARTITION
p0
VALUES
IN
(
0
)
DATA
DIRECTORY
'$MYSQLTEST_VARDIR/tmp'
DATA
DIRECTORY
'$MYSQLTEST_VARDIR/tmp'
...
@@ -82,6 +84,7 @@ connection default;
...
@@ -82,6 +84,7 @@ connection default;
USE
mysqltest2
;
USE
mysqltest2
;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
eval
CREATE
TABLE
t1
(
a
INT
)
eval
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
MyISAM
PARTITION
BY
LIST
(
a
)
(
PARTITION
BY
LIST
(
a
)
(
PARTITION
p0
VALUES
IN
(
0
)
PARTITION
p0
VALUES
IN
(
0
)
DATA
DIRECTORY
'$MYSQLTEST_VARDIR/tmp'
DATA
DIRECTORY
'$MYSQLTEST_VARDIR/tmp'
...
@@ -96,6 +99,7 @@ connection con1;
...
@@ -96,6 +99,7 @@ connection con1;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
error
1
,
1
--
error
1
,
1
eval
CREATE
TABLE
t1
(
a
INT
)
eval
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
MyISAM
PARTITION
BY
LIST
(
a
)
(
PARTITION
BY
LIST
(
a
)
(
PARTITION
p0
VALUES
IN
(
0
)
PARTITION
p0
VALUES
IN
(
0
)
DATA
DIRECTORY
'$MYSQLTEST_VARDIR/tmp'
DATA
DIRECTORY
'$MYSQLTEST_VARDIR/tmp'
...
@@ -107,6 +111,7 @@ connection con1;
...
@@ -107,6 +111,7 @@ connection con1;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
error
1
,
1
--
error
1
,
1
eval
CREATE
TABLE
t1
(
a
INT
)
eval
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
MyISAM
PARTITION
BY
LIST
(
a
)
(
PARTITION
BY
LIST
(
a
)
(
PARTITION
p0
VALUES
IN
(
0
)
PARTITION
p0
VALUES
IN
(
0
)
DATA
DIRECTORY
'$MYSQLTEST_VARDIR/tmp'
DATA
DIRECTORY
'$MYSQLTEST_VARDIR/tmp'
...
@@ -128,6 +133,7 @@ connection default;
...
@@ -128,6 +133,7 @@ connection default;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
eval
create
table
t2
(
i
int
)
eval
create
table
t2
(
i
int
)
ENGINE
=
MyISAM
partition
by
range
(
i
)
partition
by
range
(
i
)
(
(
partition
p01
values
less
than
(
1000
)
partition
p01
values
less
than
(
1000
)
...
@@ -139,6 +145,7 @@ set @org_mode=@@sql_mode;
...
@@ -139,6 +145,7 @@ set @org_mode=@@sql_mode;
set
@@
sql_mode
=
'NO_DIR_IN_CREATE'
;
set
@@
sql_mode
=
'NO_DIR_IN_CREATE'
;
select
@@
sql_mode
;
select
@@
sql_mode
;
create
table
t1
(
i
int
)
create
table
t1
(
i
int
)
ENGINE
=
MyISAM
partition
by
range
(
i
)
partition
by
range
(
i
)
(
(
partition
p01
values
less
than
(
1000
)
partition
p01
values
less
than
(
1000
)
...
@@ -157,6 +164,7 @@ set @@sql_mode=@org_mode;
...
@@ -157,6 +164,7 @@ set @@sql_mode=@org_mode;
# Added ER_WRONG_TABLE_NAME and reported bug#39045
# Added ER_WRONG_TABLE_NAME and reported bug#39045
--
error
ER_WRONG_ARGUMENTS
,
ER_WRONG_TABLE_NAME
--
error
ER_WRONG_ARGUMENTS
,
ER_WRONG_TABLE_NAME
create
table
t1
(
a
int
)
create
table
t1
(
a
int
)
ENGINE
=
MyISAM
partition
by
key
(
a
)
partition
by
key
(
a
)
(
partition
p0
DATA
DIRECTORY
'part-data'
INDEX
DIRECTORY
'part-data'
);
(
partition
p0
DATA
DIRECTORY
'part-data'
INDEX
DIRECTORY
'part-data'
);
...
@@ -167,6 +175,7 @@ partition by key (a)
...
@@ -167,6 +175,7 @@ partition by key (a)
# Added ER_WRONG_TABLE_NAME and reported bug#39045
# Added ER_WRONG_TABLE_NAME and reported bug#39045
--
error
ER_WRONG_ARGUMENTS
,
ER_WRONG_TABLE_NAME
--
error
ER_WRONG_ARGUMENTS
,
ER_WRONG_TABLE_NAME
create
table
t1
(
a
int
)
create
table
t1
(
a
int
)
ENGINE
=
MyISAM
partition
by
key
(
a
)
partition
by
key
(
a
)
(
partition
p0
,
(
partition
p0
,
partition
p1
DATA
DIRECTORY
'part-data'
INDEX
DIRECTORY
'part-data'
);
partition
p1
DATA
DIRECTORY
'part-data'
INDEX
DIRECTORY
'part-data'
);
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