Debian Codegraph @

mysql-test/suite/storage_engine/col_opt_default.test

raw
1 #
2 # Check whether DEFAULT column attribute
3 # is supported in CREATE and ALTER TABLE.
4 # If the attribute is supported at all, it will be covered
5 # in more details in col_option_null and col_option_not_null tests.
6 #
7
8 --source have_engine.inc
9
10 --disable_warnings
11 DROP TABLE IF EXISTS t1;
12 --enable_warnings
13
14 --let $create_definition = a $int_col DEFAULT '0'
15 --source create_table.inc
16 if ($mysql_errname)
17 {
18 --let $functionality = DEFAULT values
19 --source unexpected_result.inc
20 }
21 if (!$mysql_errname)
22 {
23 --replace_column 3 #
24 SHOW COLUMNS IN t1;
25
26 INSERT INTO t1 (a) VALUES (1);
27 --sorted_result
28 SELECT a FROM t1;
29
30 --let $alter_definition = ADD COLUMN b $char_col DEFAULT ''
31 --source alter_table.inc
32 if ($mysql_errname)
33 {
34 --let $functionality = ALTER or DEFAULT
35 --source unexpected_result.inc
36 }
37 if (!$mysql_errname)
38 {
39 --replace_column 3 #
40 SHOW COLUMNS IN t1;
41
42 INSERT INTO t1 (b) VALUES ('a');
43 --sorted_result
44 SELECT a,b FROM t1;
45 }
46 DROP TABLE t1;
47 }
48 --source cleanup_engine.inc
49