From 413112fb55afb352537f35a77d17327f5370c873 Mon Sep 17 00:00:00 2001 From: "svoj@mysql.com/june.mysql.com" <> Date: Fri, 7 Dec 2007 14:44:03 +0400 Subject: [PATCH] BUG#32817 - though CSV is marked as supported create table is rejected with error 1005. CSV doesn't support nullable fields. Report descriptive error if create table with nullable field is requested. --- mysql-test/r/csv.result | 10 ++++++++-- mysql-test/t/csv.test | 11 +++++++++-- storage/csv/ha_tina.cc | 5 ++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result index 69f77dc3cd8..b0033383f00 100644 --- a/mysql-test/r/csv.result +++ b/mysql-test/r/csv.result @@ -5364,13 +5364,19 @@ BIN(a) 0 drop table t1; create table t1(a enum('foo','bar') default null) engine=csv; -ERROR HY000: Can't create table 'test.t1' (errno: -1) +ERROR 42000: The storage engine for the table doesn't support nullable columns create table t1(a enum('foo','bar') default 'foo') engine=csv; -ERROR HY000: Can't create table 'test.t1' (errno: -1) +ERROR 42000: The storage engine for the table doesn't support nullable columns create table t1(a enum('foo','bar') default 'foo' not null) engine=csv; insert into t1 values(); select * from t1; a foo drop table t1; +CREATE TABLE t1(a INT) ENGINE=CSV; +ERROR 42000: The storage engine for the table doesn't support nullable columns +SHOW WARNINGS; +Level Code Message +Error 1178 The storage engine for the table doesn't support nullable columns +Error 1005 Can't create table 'test.t1' (errno: 138) End of 5.1 tests diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index 6c83fbfdc9c..7b4f95bbf8a 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1755,9 +1755,9 @@ insert into t1 values(); select BIN(a) from t1; drop table t1; # We prevent creation of table with nullable ENUM ---error ER_CANT_CREATE_TABLE +--error ER_CHECK_NOT_IMPLEMENTED create table t1(a enum('foo','bar') default null) engine=csv; ---error ER_CANT_CREATE_TABLE +--error ER_CHECK_NOT_IMPLEMENTED create table t1(a enum('foo','bar') default 'foo') engine=csv; # Enum columns must be specified as NOT NULL create table t1(a enum('foo','bar') default 'foo' not null) engine=csv; @@ -1765,5 +1765,12 @@ insert into t1 values(); select * from t1; drop table t1; +# +# BUG#32817 - though CSV is marked as supported create table is rejected +# with error 1005. +# +--error ER_CHECK_NOT_IMPLEMENTED +CREATE TABLE t1(a INT) ENGINE=CSV; +SHOW WARNINGS; --echo End of 5.1 tests diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 75c3f70dec4..b5ef4620108 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -1486,7 +1486,10 @@ int ha_tina::create(const char *name, TABLE *table_arg, for (Field **field= table_arg->s->field; *field; field++) { if ((*field)->real_maybe_null()) - DBUG_RETURN(-1); + { + my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "nullable columns"); + DBUG_RETURN(HA_ERR_UNSUPPORTED); + } }