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 |
-- disable_warnings
|
|
21 |
DROP TABLE IF EXISTS t1; |
|
22 |
-- enable_warnings
|
|
23 |
||
24 |
CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV; |
|
25 |
ALTER TABLE t1 ADD COLUMN b CHAR(5) NOT NULL; |
|
26 |
DESC t1; |
|
27 |
ALTER TABLE t1 DROP COLUMN b; |
|
28 |
DESC t1; |
|
29 |
ALTER TABLE t1 MODIFY a BIGINT NOT NULL; |
|
30 |
DESC t1; |
|
31 |
ALTER TABLE t1 CHANGE a a INT NOT NULL; |
|
32 |
DESC t1; |
|
33 |
||
34 |
DROP TABLE t1; |
|
35 |
||
36 |
#############################################################################
|
|
37 |
# Testcase csv_alter_table.2: Negative test for ALTER table |
|
38 |
# These queries should not succeed / should throw errors |
|
39 |
#############################################################################
|
|
40 |
-- echo # ===== csv_alter_table.2 =====
|
|
41 |
-- disable_warnings
|
|
42 |
DROP TABLE IF EXISTS t1; |
|
43 |
-- enable_warnings
|
|
44 |
||
45 |
CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV; |
|
46 |
--error ER_CHECK_NOT_IMPLEMENTED
|
|
47 |
ALTER TABLE t1 ADD COLUMN b CHAR(5); |
|
48 |
DESC t1; |
|
49 |
--error ER_CHECK_NOT_IMPLEMENTED
|
|
50 |
ALTER TABLE t1 MODIFY a BIGINT; |
|
51 |
DESC t1; |
|
52 |
--error ER_CHECK_NOT_IMPLEMENTED
|
|
53 |
ALTER TABLE t1 CHANGE a a INT; |
|
54 |
DESC t1; |
|
55 |
||
56 |
DROP TABLE t1; |