summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <pcrews@pcrews-mac-local.local>2008-01-21 13:49:03 -0500
committerunknown <pcrews@pcrews-mac-local.local>2008-01-21 13:49:03 -0500
commit63c73b52f3c67ffe8510c7dc8af12411136cee65 (patch)
treea300d6e5787ab2227d0713105a55a82f70bc711c
parented2ab9338e9c0c3aed387e3264ea40b7e792c559 (diff)
downloadmariadb-git-63c73b52f3c67ffe8510c7dc8af12411136cee65.tar.gz
New tests added for Bug#33558 - Test "stress.ddl_csv needs nullable columns which CSV does not support
Added new tests and corrected existing tests mysql-test/suite/stress/include/ddl3.inc: New tests added for Bug#33558 - Test "stress.ddl_csv needs nullable columns which CSV does not support Had to change CREATE TABLE statements to include NOT NULL due to CSV engine constraints mysql-test/suite/stress/r/ddl_archive.result: New tests added for Bug#33558 - Test "stress.ddl_csv needs nullable columns which CSV does not support Reproduced .result files due to changes in ddl3.inc mysql-test/suite/stress/r/ddl_csv.result: New tests added for Bug#33558 - Test "stress.ddl_csv needs nullable columns which CSV does not support Reproduced .result files due to changes in ddl3.inc mysql-test/suite/stress/r/ddl_innodb.result: New tests added for Bug#33558 - Test "stress.ddl_csv needs nullable columns which CSV does not support Reproduced .result files due to changes in ddl3.inc mysql-test/suite/stress/r/ddl_memory.result: New tests added for Bug#33558 - Test "stress.ddl_csv needs nullable columns which CSV does not support Reproduced .result files due to changes in ddl3.inc mysql-test/suite/stress/r/ddl_myisam.result: New tests added for Bug#33558 - Test "stress.ddl_csv needs nullable columns which CSV does not support Reproduced .result files due to changes in ddl3.inc mysql-test/suite/stress/r/ddl_ndb.result: New tests added for Bug#33558 - Test "stress.ddl_csv needs nullable columns which CSV does not support Reproduced .result files due to changes in ddl3.inc BitKeeper/etc/ignore: Added mysql-test/.DS_Store .DS_Store to the ignore list mysql-test/t/disabled.def: Disabled new test - csv_alter_table.test file due to Bug#33696. Cannot generate a .result file due to the Bug. These tests can be enabled to test the bug fix without needing new tests unless the developer feels the need to add more. mysql-test/r/csv_not_null.result: New tests added for Bug#33558 - Test "stress.ddl_csv needs nullable columns which CSV does not support mysql-test/t/csv_alter_table.test: New tests added for Bug#33558 - Test "stress.ddl_csv needs nullable columns which CSV does not support Designed to test fixes for Bug#33696 - CSV Engine allows nullable columns via ALTER TABLE statements mysql-test/t/csv_not_null.test: New tests added for Bug#33558 - Test "stress.ddl_csv needs nullable columns which CSV does not support
-rw-r--r--.bzrignore2
-rw-r--r--mysql-test/r/csv_not_null.result59
-rw-r--r--mysql-test/suite/stress/include/ddl3.inc2
-rw-r--r--mysql-test/suite/stress/r/ddl_archive.result16
-rw-r--r--mysql-test/suite/stress/r/ddl_csv.result16
-rw-r--r--mysql-test/suite/stress/r/ddl_innodb.result16
-rw-r--r--mysql-test/suite/stress/r/ddl_memory.result16
-rw-r--r--mysql-test/suite/stress/r/ddl_myisam.result16
-rw-r--r--mysql-test/suite/stress/r/ddl_ndb.result16
-rw-r--r--mysql-test/t/csv_alter_table.test56
-rw-r--r--mysql-test/t/csv_not_null.test106
-rw-r--r--mysql-test/t/disabled.def1
12 files changed, 273 insertions, 49 deletions
diff --git a/.bzrignore b/.bzrignore
index 4477d4f1243..c54795778c8 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -3015,3 +3015,5 @@ zlib/*.vcproj
mysql-test/funcs_1.log
mysql-test/funcs_1.tar
mysql-test/suite/funcs_1.tar.gz
+mysql-test/.DS_Store
+.DS_Store
diff --git a/mysql-test/r/csv_not_null.result b/mysql-test/r/csv_not_null.result
new file mode 100644
index 00000000000..9757d258618
--- /dev/null
+++ b/mysql-test/r/csv_not_null.result
@@ -0,0 +1,59 @@
+# ===== csv_not_null.1 =====
+DROP TABLE IF EXISTS t1, t2;
+# === Will fail -- no NOT NULL ===
+CREATE TABLE t1 (a int) ENGINE = CSV;
+ERROR 42000: The storage engine for the table doesn't support nullable columns
+# === Good CREATE ===
+CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
+# === Will fail -- ALL columns need NOT NULL ==
+CREATE TABLE t2 (a int NOT NULL, b char(20)) ENGINE = CSV;
+ERROR 42000: The storage engine for the table doesn't support nullable columns
+DROP TABLE t1;
+# ===== csv_not_null.2 =====
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a int NOT NULL, b blob NOT NULL, c CHAR(20) NOT NULL,
+d VARCHAR(20) NOT NULL, e enum('foo','bar') NOT NULL,f DATE NOT NULL)
+ENGINE = CSV;
+# === should result in default for each datatype ===
+INSERT INTO t1 VALUES();
+SELECT * FROM t1;
+a b c d e f
+0 foo 0000-00-00
+SELECT * FROM t1;
+a b c d e f
+0 foo 0000-00-00
+INSERT INTO t1 VALUES(0,'abc','def','ghi','bar','1999-12-31');
+SELECT * FROM t1;
+a b c d e f
+0 foo 0000-00-00
+0 abc def ghi bar 1999-12-31
+# === insert failures ===
+INSERT INTO t1 VALUES(NULL,'ab','a','b','foo','2007-01-01');
+ERROR 23000: Column 'a' cannot be null
+INSERT INTO t1 VALUES(default(a),default(b), default(c), default(d),
+default(e), default(f));
+ERROR HY000: Field 'a' doesn't have a default value
+DROP TABLE t1;
+# ===== csv_not_null.3 =====
+DROP TABLE IF EXISTS t1;
+CREATE DATABASE csv_not_null_test;
+USE csv_not_null_test;
+CREATE TABLE t1 (a int NOT NULL, b char(10) NOT NULL) ENGINE = CSV;
+INSERT INTO t1 VALUES();
+Warnings:
+Warning 1364 Field 'a' doesn't have a default value
+Warning 1364 Field 'b' doesn't have a default value
+SELECT * FROM t1;
+a b
+0
+UPDATE t1 set b = 'new_value' where a = 0;
+SELECT * FROM t1;
+a b
+0 new_value
+UPDATE t1 set b = NULL where b = 'new_value';
+Warnings:
+Warning 1048 Column 'b' cannot be null
+SELECT * FROM t1;
+a b
+0
+DROP TABLE t1;
diff --git a/mysql-test/suite/stress/include/ddl3.inc b/mysql-test/suite/stress/include/ddl3.inc
index aacf09f9428..d41c8506be4 100644
--- a/mysql-test/suite/stress/include/ddl3.inc
+++ b/mysql-test/suite/stress/include/ddl3.inc
@@ -24,7 +24,7 @@
#----------------------------------------------------------------------
# Settings for Subtest 3 variants
# Scenario: CREATE TABLE/CREATE TABLE(F)/DROP TABLE/DROP TABLE(F)
-let $create_table= CREATE TABLE t1 (f1 BIGINT) ENGINE=$engine_type;
+let $create_table= CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=$engine_type;
let $drop_table= DROP TABLE t1;
#----------------------------------------------------------------------
diff --git a/mysql-test/suite/stress/r/ddl_archive.result b/mysql-test/suite/stress/r/ddl_archive.result
index 47c64a6af94..457fc30b9f9 100644
--- a/mysql-test/suite/stress/r/ddl_archive.result
+++ b/mysql-test/suite/stress/r/ddl_archive.result
@@ -29,26 +29,26 @@ DROP TABLE IF EXISTS t1;
# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE)
# Subtest 3A (one connection, no PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=ARCHIVE
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=ARCHIVE (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=ARCHIVE
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=ARCHIVE (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3B (one connection, use PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=ARCHIVE
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=ARCHIVE (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=ARCHIVE
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=ARCHIVE (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3C (two connections, no PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=ARCHIVE
-# con2: CREATE TABLE t1 (f1 BIGINT) ENGINE=ARCHIVE (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=ARCHIVE
+# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=ARCHIVE (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3D (two connections, use PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=ARCHIVE
-# con2: CREATE TABLE t1 (f1 BIGINT) ENGINE=ARCHIVE (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=ARCHIVE
+# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=ARCHIVE (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 5A (one connection, no PREPARE/EXECUTE)
diff --git a/mysql-test/suite/stress/r/ddl_csv.result b/mysql-test/suite/stress/r/ddl_csv.result
index 3dfa0c8fd15..2346638360b 100644
--- a/mysql-test/suite/stress/r/ddl_csv.result
+++ b/mysql-test/suite/stress/r/ddl_csv.result
@@ -29,26 +29,26 @@ DROP TABLE IF EXISTS t1;
# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE)
# Subtest 3A (one connection, no PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=CSV
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=CSV (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=CSV
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=CSV (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3B (one connection, use PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=CSV
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=CSV (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=CSV
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=CSV (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3C (two connections, no PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=CSV
-# con2: CREATE TABLE t1 (f1 BIGINT) ENGINE=CSV (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=CSV
+# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=CSV (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3D (two connections, use PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=CSV
-# con2: CREATE TABLE t1 (f1 BIGINT) ENGINE=CSV (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=CSV
+# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=CSV (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
DEALLOCATE PREPARE stmt_start;
diff --git a/mysql-test/suite/stress/r/ddl_innodb.result b/mysql-test/suite/stress/r/ddl_innodb.result
index 6417d3e1c5c..911aed2622a 100644
--- a/mysql-test/suite/stress/r/ddl_innodb.result
+++ b/mysql-test/suite/stress/r/ddl_innodb.result
@@ -53,26 +53,26 @@ ENGINE = InnoDB
# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE)
# Subtest 3A (one connection, no PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=InnoDB
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=InnoDB (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=InnoDB
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=InnoDB (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3B (one connection, use PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=InnoDB
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=InnoDB (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=InnoDB
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=InnoDB (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3C (two connections, no PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=InnoDB
-# con2: CREATE TABLE t1 (f1 BIGINT) ENGINE=InnoDB (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=InnoDB
+# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=InnoDB (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3D (two connections, use PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=InnoDB
-# con2: CREATE TABLE t1 (f1 BIGINT) ENGINE=InnoDB (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=InnoDB
+# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=InnoDB (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=InnoDB;
diff --git a/mysql-test/suite/stress/r/ddl_memory.result b/mysql-test/suite/stress/r/ddl_memory.result
index 1700fbc2745..7ad9f9a61c5 100644
--- a/mysql-test/suite/stress/r/ddl_memory.result
+++ b/mysql-test/suite/stress/r/ddl_memory.result
@@ -53,26 +53,26 @@ ENGINE = MEMORY
# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE)
# Subtest 3A (one connection, no PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MEMORY
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MEMORY (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MEMORY
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MEMORY (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3B (one connection, use PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MEMORY
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MEMORY (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MEMORY
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MEMORY (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3C (two connections, no PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MEMORY
-# con2: CREATE TABLE t1 (f1 BIGINT) ENGINE=MEMORY (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MEMORY
+# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MEMORY (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3D (two connections, use PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MEMORY
-# con2: CREATE TABLE t1 (f1 BIGINT) ENGINE=MEMORY (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MEMORY
+# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MEMORY (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=MEMORY;
diff --git a/mysql-test/suite/stress/r/ddl_myisam.result b/mysql-test/suite/stress/r/ddl_myisam.result
index 82be55b8371..808b22dc859 100644
--- a/mysql-test/suite/stress/r/ddl_myisam.result
+++ b/mysql-test/suite/stress/r/ddl_myisam.result
@@ -53,26 +53,26 @@ ENGINE = MyISAM
# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE)
# Subtest 3A (one connection, no PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MyISAM
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MyISAM (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MyISAM
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MyISAM (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3B (one connection, use PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MyISAM
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MyISAM (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MyISAM
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MyISAM (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3C (two connections, no PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MyISAM
-# con2: CREATE TABLE t1 (f1 BIGINT) ENGINE=MyISAM (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MyISAM
+# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MyISAM (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3D (two connections, use PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=MyISAM
-# con2: CREATE TABLE t1 (f1 BIGINT) ENGINE=MyISAM (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MyISAM
+# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=MyISAM (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=MyISAM;
diff --git a/mysql-test/suite/stress/r/ddl_ndb.result b/mysql-test/suite/stress/r/ddl_ndb.result
index 39146e65fb0..05c29456f7c 100644
--- a/mysql-test/suite/stress/r/ddl_ndb.result
+++ b/mysql-test/suite/stress/r/ddl_ndb.result
@@ -53,26 +53,26 @@ ENGINE = NDB
# con2: SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1 (expect to get ER_NO_SUCH_TABLE)
# Subtest 3A (one connection, no PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=NDB
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=NDB (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=NDB
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=NDB (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3B (one connection, use PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=NDB
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=NDB (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=NDB
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=NDB (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# default: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3C (two connections, no PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=NDB
-# con2: CREATE TABLE t1 (f1 BIGINT) ENGINE=NDB (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=NDB
+# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=NDB (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
# Subtest 3D (two connections, use PREPARE/EXECUTE)
# connection action
-# default: CREATE TABLE t1 (f1 BIGINT) ENGINE=NDB
-# con2: CREATE TABLE t1 (f1 BIGINT) ENGINE=NDB (expect to get ER_TABLE_EXISTS_ERROR)
+# default: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=NDB
+# con2: CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=NDB (expect to get ER_TABLE_EXISTS_ERROR)
# default: DROP TABLE t1
# con2: DROP TABLE t1 (expect to get ER_BAD_TABLE_ERROR)
CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=NDB;
diff --git a/mysql-test/t/csv_alter_table.test b/mysql-test/t/csv_alter_table.test
new file mode 100644
index 00000000000..0093a1d10a7
--- /dev/null
+++ b/mysql-test/t/csv_alter_table.test
@@ -0,0 +1,56 @@
+#-----------------------------------------------------------------------------
+# csv_alter_table.test - .test file for MySQL regression suite
+# Purpose: To test the behavior of the CSV engine
+# Bug#31473 resulted in strict enforcement of non-nullable
+# columns in CSV engine.
+# Tests code for Bug#33696 - CSV engine allows NULLable
+# Columns via ALTER TABLE statements
+#
+# Author pcrews
+# Last modified: 2008-01-06
+#-----------------------------------------------------------------------------
+
+--source include/have_csv.inc
+
+#############################################################################
+# Testcase csv_alter_table.1: Positive test for ALTER table
+#
+#############################################################################
+-- echo # ===== csv_alter_table.1 =====
+-- disable_warnings
+DROP TABLE IF EXISTS t1;
+-- enable_warnings
+
+CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
+ALTER TABLE t1 ADD COLUMN b CHAR(5) NOT NULL;
+DESC t1;
+ALTER TABLE t1 DROP COLUMN b;
+DESC t1;
+ALTER TABLE t1 MODIFY a BIGINT NOT NULL;
+DESC t1;
+ALTER TABLE t1 CHANGE a a INT NOT NULL;
+DESC t1;
+
+DROP TABLE t1;
+
+#############################################################################
+# Testcase csv_alter_table.2: Negative test for ALTER table
+# These queries should not succeed / should throw errors
+#############################################################################
+-- echo # ===== csv_alter_table.2 =====
+-- disable_warnings
+DROP TABLE IF EXISTS t1;
+-- enable_warnings
+
+CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
+--error ER_CHECK_NOT_IMPLEMENTED
+ALTER TABLE t1 ADD COLUMN b CHAR(5);
+DESC t1;
+--error ER_CHECK_NOT_IMPLEMENTED
+ALTER TABLE t1 MODIFY a BIGINT;
+DESC t1;
+--error ER_CHECK_NOT_IMPLEMENTED
+ALTER TABLE t1 CHANGE a a INT;
+DESC t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/csv_not_null.test b/mysql-test/t/csv_not_null.test
new file mode 100644
index 00000000000..e79688fd95f
--- /dev/null
+++ b/mysql-test/t/csv_not_null.test
@@ -0,0 +1,106 @@
+#-----------------------------------------------------------------------------
+# csv_not_null.test - .test file for MySQL regression suite
+# Purpose: To test the behavior of the CSV engine
+# Bug#31473 resulted in strict enforcement of non-nullable
+# columns in CSV engine.
+# NOTE: Main functionality tested - NOT NULL restrictions on CSV tables
+# CREATE, INSERT, and UPDATE statements
+# ALTER statements in separate file due to BUG#33696
+# Author pcrews
+# Last modified: 2008-01-04
+#-----------------------------------------------------------------------------
+
+--source include/have_csv.inc
+
+#############################################################################
+# Testcase csv_not_null.1: CREATE TABLE for CSV Engine requires explicit
+# NOT NULL for each column
+#############################################################################
+-- echo # ===== csv_not_null.1 =====
+-- disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+-- enable_warnings
+
+
+--echo # === Will fail -- no NOT NULL ===
+--error ER_CHECK_NOT_IMPLEMENTED
+CREATE TABLE t1 (a int) ENGINE = CSV;
+
+--echo # === Good CREATE ===
+CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
+
+--echo # === Will fail -- ALL columns need NOT NULL ==
+--error ER_CHECK_NOT_IMPLEMENTED
+CREATE TABLE t2 (a int NOT NULL, b char(20)) ENGINE = CSV;
+
+
+DROP TABLE t1;
+##############################################################################
+# Testcase csv_not_null.2: INSERT tests -- validating behavior of INSERT
+# statements for CSV
+##############################################################################
+-- echo # ===== csv_not_null.2 =====
+-- disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+
+CREATE TABLE t1 (a int NOT NULL, b blob NOT NULL, c CHAR(20) NOT NULL,
+d VARCHAR(20) NOT NULL, e enum('foo','bar') NOT NULL,f DATE NOT NULL)
+ENGINE = CSV;
+-- echo # === should result in default for each datatype ===
+-- disable_warnings
+INSERT INTO t1 VALUES();
+-- enable_warnings
+SELECT * FROM t1;
+
+-- disable_warnings
+# NOTE - Test disabled due to enum crash for this INSERT
+# See Bug#33717 - INSERT...(default) fails for enum.
+# Crashes CSV tables, loads spaces for MyISAM
+#INSERT INTO t1 VALUES(default,default,default,default,default,default);
+-- enable_warnings
+
+SELECT * FROM t1;
+INSERT INTO t1 VALUES(0,'abc','def','ghi','bar','1999-12-31');
+SELECT * FROM t1;
+-- echo # === insert failures ===
+--error ER_BAD_NULL_ERROR
+INSERT INTO t1 VALUES(NULL,'ab','a','b','foo','2007-01-01');
+--error ER_NO_DEFAULT_FOR_FIELD
+INSERT INTO t1 VALUES(default(a),default(b), default(c), default(d),
+ default(e), default(f));
+
+
+DROP TABLE t1;
+
+##############################################################################
+# Testcase csv_not_null.3: UPDATE tests -- examining behavior of UPDATE
+# statements for CSV
+# NOTE: Should not allow UPDATE <table> set <NOT_NULL_COLUMN> = NULL
+# WHERE <condition>;
+# However, this is currently allowed -- <NOT_NULL_COLUMN> is
+# set to the default value for the given datatype
+# Might have to change this test depending on the action taken for
+# Bug#33699 (addressing this behavior)
+##############################################################################
+-- echo # ===== csv_not_null.3 =====
+-- disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE DATABASE csv_not_null_test;
+USE csv_not_null_test;
+
+CREATE TABLE t1 (a int NOT NULL, b char(10) NOT NULL) ENGINE = CSV;
+INSERT INTO t1 VALUES();
+SELECT * FROM t1;
+UPDATE t1 set b = 'new_value' where a = 0;
+SELECT * FROM t1;
+# Might need to change this depending on Bug#33699 -UPDATE allows NULL
+# as new value on NOT NULL columns (= default datatype value)
+# Currently sets to datatype default -- might throw error
+UPDATE t1 set b = NULL where b = 'new_value';
+SELECT * FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 3f9ec52ca36..15d02ac674a 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -23,3 +23,4 @@ wait_timeout : Bug#32801 wait_timeout.test fails randomly
ctype_create : Bug#32965 main.ctype_create fails
status : Bug#32966 main.status fails
ps_ddl : Bug#12093 2007-12-14 pending WL#4165 / WL#4166
+csv_alter_table : Bug#33696 2008-01-21 pcrews no .result file - bug allows NULL columns in CSV tables