1
by brian
clean slate |
1 |
#----------------------------------------------------------------------------- |
2 |
# csv_alter_table.test - .test file for MySQL regression suite |
|
3 |
# Purpose: To test the behavior of the CSV engine |
|
4 |
# Bug#31473 resulted in strict enforcement of non-nullable |
|
5 |
# columns in CSV engine. |
|
6 |
# Tests code for Bug#33696 - CSV engine allows NULLable |
|
7 |
# Columns via ALTER TABLE statements |
|
8 |
#
|
|
9 |
# Author pcrews |
|
10 |
# Last modified: 2008-01-06 |
|
11 |
#----------------------------------------------------------------------------- |
|
12 |
||
13 |
--source include/have_csv.inc
|
|
14 |
||
15 |
#############################################################################
|
|
16 |
# Testcase csv_alter_table.1: Positive test for ALTER table |
|
17 |
#
|
|
18 |
#############################################################################
|
|
19 |
-- echo # ===== csv_alter_table.1 =====
|
|
20 |
DROP TABLE IF EXISTS t1; |
|
21 |
||
22 |
CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV; |
|
23 |
ALTER TABLE t1 ADD COLUMN b CHAR(5) NOT NULL; |
|
24 |
DESC t1; |
|
25 |
ALTER TABLE t1 DROP COLUMN b; |
|
26 |
DESC t1; |
|
27 |
ALTER TABLE t1 MODIFY a BIGINT NOT NULL; |
|
28 |
DESC t1; |
|
29 |
ALTER TABLE t1 CHANGE a a INT NOT NULL; |
|
30 |
DESC t1; |
|
31 |
||
32 |
DROP TABLE t1; |
|
33 |
||
34 |
#############################################################################
|
|
35 |
# Testcase csv_alter_table.2: Negative test for ALTER table |
|
36 |
# These queries should not succeed / should throw errors |
|
37 |
#############################################################################
|
|
38 |
-- echo # ===== csv_alter_table.2 =====
|
|
39 |
DROP TABLE IF EXISTS t1; |
|
40 |
||
41 |
CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV; |
|
42 |
--error ER_CHECK_NOT_IMPLEMENTED
|
|
43 |
ALTER TABLE t1 ADD COLUMN b CHAR(5); |
|
44 |
DESC t1; |
|
45 |
--error ER_CHECK_NOT_IMPLEMENTED
|
|
46 |
ALTER TABLE t1 MODIFY a BIGINT; |
|
47 |
DESC t1; |
|
48 |
--error ER_CHECK_NOT_IMPLEMENTED
|
|
49 |
ALTER TABLE t1 CHANGE a a INT; |
|
50 |
DESC t1; |
|
51 |
||
52 |
DROP TABLE t1; |