mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / r / csv_not_null.result
blobaed9bcb1587d03c3bb93176d0ae54c3281a30fbd
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
6 # === Good CREATE ===
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
11 DROP TABLE t1;
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) 
16 ENGINE = CSV;
17 # === should result in default for each datatype ===
18 INSERT INTO t1 VALUES();
19 SELECT * FROM t1;
20 a       b       c       d       e       f
21 0                               foo     0000-00-00
22 INSERT INTO t1 VALUES(default,default,default,default,default,default);
23 SELECT * FROM t1;
24 a       b       c       d       e       f
25 0                               foo     0000-00-00
26 0                               foo     0000-00-00
27 INSERT INTO t1 VALUES(0,'abc','def','ghi','bar','1999-12-31');
28 SELECT * FROM t1;
29 a       b       c       d       e       f
30 0                               foo     0000-00-00
31 0                               foo     0000-00-00
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
39 DROP TABLE t1;
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();
44 SELECT * FROM t1;
45 a       b
46 0       
47 UPDATE t1 set b = 'new_value' where a = 0;
48 SELECT * FROM t1;
49 a       b
50 0       new_value
51 UPDATE t1 set b = NULL where b = 'new_value';
52 Warnings:
53 Warning 1048    Column 'b' cannot be null
54 SELECT * FROM t1;
55 a       b
56 0       
57 DROP TABLE t1;