2001-09-28 07:05:54 +02:00
drop table if exists t1,t2,t7,t8,t9;
2003-07-03 18:23:06 +02:00
drop database if exists mysqltest;
2001-09-28 07:05:54 +02:00
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a));
create table t2 (a int not null auto_increment, b char(16) not null, primary key (a));
insert into t1 (b) values ("test"),("test1"),("test2"),("test3");
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
drop table t2;
2011-01-31 10:34:39 +01:00
create table t9 (a int not null auto_increment, b char(16) not null, primary key (a))
engine=myisam data directory="MYSQLTEST_VARDIR/tmp" index directory="MYSQLTEST_VARDIR/run";
2001-09-28 07:05:54 +02:00
insert into t9 select * from t1;
check table t9;
2001-06-05 02:38:10 +02:00
Table Op Msg_type Msg_text
test.t9 check status OK
2001-09-28 07:05:54 +02:00
optimize table t9;
2001-06-05 02:38:10 +02:00
Table Op Msg_type Msg_text
test.t9 optimize status OK
2001-09-28 07:05:54 +02:00
repair table t9;
2001-06-05 02:38:10 +02:00
Table Op Msg_type Msg_text
test.t9 repair status OK
2001-09-28 07:05:54 +02:00
alter table t9 add column c int not null;
show create table t9;
2001-06-05 02:38:10 +02:00
Table Create Table
t9 CREATE TABLE `t9` (
2006-02-22 10:09:59 +01:00
`a` int(11) NOT NULL AUTO_INCREMENT,
2004-10-07 14:28:05 +02:00
`b` char(16) NOT NULL,
`c` int(11) NOT NULL,
2006-02-02 20:39:28 +01:00
PRIMARY KEY (`a`)
2024-05-28 07:08:51 +02:00
) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
2001-09-28 07:05:54 +02:00
alter table t9 rename t8, add column d int not null;
alter table t8 rename t7;
rename table t7 to t9;
drop table t1;
2005-01-19 00:05:16 +01:00
SHOW CREATE TABLE t9;
Table Create Table
t9 CREATE TABLE `t9` (
2006-02-22 10:09:59 +01:00
`a` int(11) NOT NULL AUTO_INCREMENT,
2005-01-19 00:05:16 +01:00
`b` char(16) NOT NULL,
`c` int(11) NOT NULL,
`d` int(11) NOT NULL,
2006-02-02 20:39:28 +01:00
PRIMARY KEY (`a`)
2024-05-28 07:08:51 +02:00
) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
2008-03-17 16:11:26 +01:00
create database mysqltest;
2011-01-31 10:34:39 +01:00
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a))
engine=myisam index directory="/this-dir-does-not-exist";
2001-11-28 02:47:15 +01:00
Got one of the listed errors
2011-01-31 10:34:39 +01:00
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a))
engine=myisam index directory="not-hard-path";
ERROR 42000: Incorrect table name 'not-hard-path'
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a))
engine=myisam index directory="MYSQLTEST_VARDIR/run";
2001-11-28 02:47:15 +01:00
Got one of the listed errors
2011-01-31 10:34:39 +01:00
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a))
engine=myisam data directory="MYSQLTEST_VARDIR/tmp";
2001-11-28 02:47:15 +01:00
Got one of the listed errors
2003-07-03 18:23:06 +02:00
alter table t9 rename mysqltest.t9;
select count(*) from mysqltest.t9;
2001-06-05 02:38:10 +02:00
count(*)
16724
2003-07-03 18:23:06 +02:00
show create table mysqltest.t9;
2001-06-05 02:38:10 +02:00
Table Create Table
t9 CREATE TABLE `t9` (
2006-02-22 10:09:59 +01:00
`a` int(11) NOT NULL AUTO_INCREMENT,
2004-10-07 14:28:05 +02:00
`b` char(16) NOT NULL,
`c` int(11) NOT NULL,
`d` int(11) NOT NULL,
2006-02-02 20:39:28 +01:00
PRIMARY KEY (`a`)
2024-05-28 07:08:51 +02:00
) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
2003-07-03 18:23:06 +02:00
drop database mysqltest;
2004-02-17 01:26:35 +01:00
create table t1 (a int not null) engine=myisam;
2008-03-17 16:11:26 +01:00
alter table t1 data directory="MYSQLTEST_VARDIR/tmp";
2006-06-27 19:22:43 +02:00
Warnings:
2008-10-24 14:50:59 +02:00
Warning 1618 <DATA DIRECTORY> option ignored
2003-12-12 21:26:58 +01:00
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
2004-10-07 14:28:05 +02:00
`a` int(11) NOT NULL
2024-05-28 07:08:51 +02:00
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
2003-12-12 21:26:58 +01:00
alter table t1 add b int;
2008-03-17 16:11:26 +01:00
alter table t1 data directory="MYSQLTEST_VARDIR/log";
2006-06-27 19:22:43 +02:00
Warnings:
2008-10-24 14:50:59 +02:00
Warning 1618 <DATA DIRECTORY> option ignored
2003-12-12 21:26:58 +01:00
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
2004-10-07 14:28:05 +02:00
`a` int(11) NOT NULL,
2006-02-22 10:09:59 +01:00
`b` int(11) DEFAULT NULL
2024-05-28 07:08:51 +02:00
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
2008-03-17 16:11:26 +01:00
alter table t1 index directory="MYSQLTEST_VARDIR/log";
2006-06-27 19:22:43 +02:00
Warnings:
2008-10-24 14:50:59 +02:00
Warning 1618 <INDEX DIRECTORY> option ignored
2003-12-12 21:26:58 +01:00
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
2004-10-07 14:28:05 +02:00
`a` int(11) NOT NULL,
2006-02-22 10:09:59 +01:00
`b` int(11) DEFAULT NULL
2024-05-28 07:08:51 +02:00
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
2003-12-12 21:26:58 +01:00
drop table t1;
2007-11-06 15:09:33 +01:00
CREATE TABLE t1(a INT)
2008-02-28 13:46:52 +01:00
DATA DIRECTORY='TEST_DIR/tmp'
INDEX DIRECTORY='TEST_DIR/tmp';
2008-03-17 16:11:26 +01:00
Got one of the listed errors
2008-02-28 13:46:52 +01:00
CREATE TABLE t2(a INT)
DATA DIRECTORY='TEST_DIR/tmp'
INDEX DIRECTORY='TEST_DIR/tmp';
RENAME TABLE t2 TO t1;
2012-07-06 18:10:18 +02:00
ERROR HY000: Can't create/write to file 'TEST_DIR/tmp/t1.MYI' (Errcode: 17 "File exists")
2008-02-28 13:46:52 +01:00
DROP TABLE t2;
2016-03-25 17:51:22 +01:00
connect session1,localhost,root,,;
connect session2,localhost,root,,;
connection session1;
2008-03-17 16:11:26 +01:00
create temporary table t1 (a int) engine=myisam data directory="MYSQLTEST_VARDIR/log" select 9 a;
2006-12-14 13:23:31 +01:00
show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
2006-12-18 14:38:12 +01:00
`a` int(11) DEFAULT NULL
2024-05-28 07:08:51 +02:00
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci DATA DIRECTORY='MYSQLTEST_VARDIR/log/'
2016-03-25 17:51:22 +01:00
connection session2;
2008-03-17 16:11:26 +01:00
create temporary table t1 (a int) engine=myisam data directory="MYSQLTEST_VARDIR/log" select 99 a;
2006-12-14 13:23:31 +01:00
show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
2006-12-18 14:38:12 +01:00
`a` int(11) DEFAULT NULL
2024-05-28 07:08:51 +02:00
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci DATA DIRECTORY='MYSQLTEST_VARDIR/log/'
2016-03-25 17:51:22 +01:00
connection default;
2006-12-14 13:23:31 +01:00
create table t1 (a int) engine=myisam select 42 a;
2016-03-25 17:51:22 +01:00
connection session1;
2006-12-14 13:23:31 +01:00
select * from t1;
a
9
2016-03-25 17:51:22 +01:00
disconnect session1;
connection session2;
2006-12-14 13:23:31 +01:00
select * from t1;
a
99
2016-03-25 17:51:22 +01:00
disconnect session2;
connection default;
2006-12-14 13:23:31 +01:00
select * from t1;
a
42
drop table t1;
2006-12-15 00:23:54 +01:00
End of 4.1 tests
2007-07-13 12:56:22 +02:00
SET SESSION keep_files_on_create = TRUE;
2021-12-02 23:55:34 +01:00
Warnings:
Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release
2007-07-13 12:56:22 +02:00
CREATE TABLE t1 (a INT) ENGINE MYISAM;
2007-07-13 22:34:46 +02:00
Got one of the listed errors
2008-02-28 13:46:52 +01:00
SET SESSION keep_files_on_create = FALSE;
2021-12-02 23:55:34 +01:00
Warnings:
Warning 1287 '@@keep_files_on_create' is deprecated and will be removed in a future release
2008-02-28 13:46:52 +01:00
CREATE TABLE t1 (a INT) ENGINE MYISAM;
DROP TABLE t1;
2006-12-15 01:47:55 +01:00
End of 5.0 tests
2008-02-28 13:46:52 +01:00
CREATE TABLE t1(a INT)
2008-04-03 21:40:10 +02:00
INDEX DIRECTORY='MYSQLD_DATADIR/mysql';
2008-11-25 15:06:31 +01:00
DROP TABLE IF EXISTS t1;
2008-02-28 13:46:52 +01:00
CREATE TABLE t1(a INT)
2008-04-03 21:40:10 +02:00
DATA DIRECTORY='MYSQLD_DATADIR/test';
2008-11-25 15:06:31 +01:00
DROP TABLE IF EXISTS t1;
2008-02-28 13:46:52 +01:00
CREATE TABLE t1(a INT)
2008-04-03 21:40:10 +02:00
DATA DIRECTORY='MYSQLD_DATADIR/';
2008-11-25 15:06:31 +01:00
DROP TABLE IF EXISTS t1;
2008-02-28 13:46:52 +01:00
CREATE TABLE t1(a INT)
2008-04-03 21:40:10 +02:00
INDEX DIRECTORY='MYSQLD_DATADIR';
2008-11-25 15:06:31 +01:00
DROP TABLE IF EXISTS t1;
2008-02-28 13:46:52 +01:00
CREATE TABLE t1(a INT)
INDEX DIRECTORY='TEST_DIR/master-data_var';
2012-07-06 18:10:18 +02:00
ERROR HY000: Can't create/write to file 'TEST_DIR/master-data_var/t1.MYI' (Errcode: 2 "No such file or directory")
2007-12-07 14:40:42 +01:00
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE';
CREATE TABLE t1(a INT) DATA DIRECTORY='MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='MYSQLTEST_VARDIR/tmp';
Warnings:
2008-10-24 14:50:59 +02:00
Warning 1618 <DATA DIRECTORY> option ignored
Warning 1618 <INDEX DIRECTORY> option ignored
2007-12-07 14:40:42 +01:00
DROP TABLE t1;
SET @@SQL_MODE=@OLD_SQL_MODE;
2010-04-01 16:49:02 +02:00
#
# BUG#40980 - Drop table can remove another MyISAM table's
# data and index files
#
CREATE TABLE user(a INT) DATA DIRECTORY='MYSQL_TMP_DIR/mysql'
INDEX DIRECTORY='MYSQL_TMP_DIR/mysql';
FLUSH TABLE user;
# Symlinking mysql database to tmpdir
FLUSH TABLE mysql.user;
DROP TABLE user;
FLUSH TABLE mysql.user;
SELECT * FROM mysql.user;
2007-12-07 14:40:42 +01:00
End of 5.1 tests
2011-06-09 14:54:12 +02:00
#
# Test for bug #11759990 - "52354: 'CREATE TABLE .. LIKE ... '
# STATEMENTS FAIL".
#
drop table if exists t1, t2;
create table t1 (a int primary key) engine=myisam
data directory="MYSQLTEST_VARDIR/tmp"
index directory="MYSQLTEST_VARDIR/run";
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
2024-05-28 07:08:51 +02:00
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
2016-02-22 12:48:03 +01:00
select create_options from information_schema.tables where table_name='t1';
create_options
DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
2011-06-09 14:54:12 +02:00
# CREATE TABLE LIKE statement on table with INDEX/DATA DIRECTORY
# options should not fail. Per documentation newly created table
# should not inherit value of these options from the original table.
create table t2 like t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
2024-05-28 07:08:51 +02:00
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
2011-06-09 14:54:12 +02:00
drop tables t1, t2;
2017-02-22 20:12:25 +01:00
#
# Test for bug #25514146 DB_NAME IS IGNORED WHEN CREATING TABLE
# WITH DATA DIRECTORY
#
# Make sure we have no current database
CREATE DATABASE x;
USE x;
DROP DATABASE x;
CREATE TABLE test.t1(id INT(11)) ENGINE MYISAM
DATA DIRECTORY "MYSQLTEST_VARDIR/tmp";
DROP TABLE test.t1;
2017-09-16 00:21:22 +02:00
use test;
create table t1(c1 int, c2 int, c3 varchar(100)) engine=MyISAM data directory='MYSQL_TMP_DIR' index directory = 'MYSQL_TMP_DIR';
insert t1 values (1,2,3), (2,3,4), (3,4,5), (4,5,6), (5,6,7), (6,7,8), (7,8,9);
alter online table t1 delay_key_write=1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL,
`c3` varchar(100) DEFAULT NULL
2024-05-28 07:08:51 +02:00
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci DELAY_KEY_WRITE=1 DATA DIRECTORY='MYSQL_TMP_DIR/' INDEX DIRECTORY='MYSQL_TMP_DIR/'
2017-09-16 00:21:22 +02:00
drop table t1;