1 # ===== csv_not_null.1 =====
2 DROP TABLE IF EXISTS t1, t2;
3 # === Will fail -- no NOT NULL ===
4 CREATE TABLE t1 (a int) ENGINE = CSV;
5 ERROR 42000: The storage engine for the table doesn't support nullable columns
7 CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
8 # === Will fail -- ALL columns need NOT NULL ==
9 CREATE TABLE t2 (a int NOT NULL, b char(20)) ENGINE = CSV;
10 ERROR 42000: The storage engine for the table doesn't support nullable columns
12 # ===== csv_not_null.2 =====
13 DROP TABLE IF EXISTS t1;
14 CREATE TABLE t1 (a int NOT NULL, b blob NOT NULL, c CHAR(20) NOT NULL,
15 d VARCHAR(20) NOT NULL, e enum('foo','bar') NOT NULL,f DATE NOT NULL)
17 # === should result in default for each datatype ===
18 INSERT INTO t1 VALUES();
22 INSERT INTO t1 VALUES(default,default,default,default,default,default);
27 INSERT INTO t1 VALUES(0,'abc','def','ghi','bar','1999-12-31');
32 0 abc def ghi bar 1999-12-31
33 # === insert failures ===
34 INSERT INTO t1 VALUES(NULL,'ab','a','b','foo','2007-01-01');
35 ERROR 23000: Column 'a' cannot be null
36 INSERT INTO t1 VALUES(default(a),default(b), default(c), default(d),
37 default(e), default(f));
38 ERROR HY000: Field 'a' doesn't have a default value
40 # ===== csv_not_null.3 =====
41 DROP TABLE IF EXISTS t1;
42 CREATE TABLE t1 (a int NOT NULL, b char(10) NOT NULL) ENGINE = CSV;
43 INSERT INTO t1 VALUES();
47 UPDATE t1 set b = 'new_value' where a = 0;
51 UPDATE t1 set b = NULL where b = 'new_value';
53 Warning 1048 Column 'b' cannot be null