summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoracurtis@xiphis.org <>2005-08-15 17:14:55 +0100
committeracurtis@xiphis.org <>2005-08-15 17:14:55 +0100
commitc414bb15209939df14ca019b458f900704ebd80d (patch)
tree0fd69e608642a529de0457f8cb26491b6f78d204
parent4880d22b79fc3ab486a4ec0b4f267bfbe06b367c (diff)
downloadmariadb-git-c414bb15209939df14ca019b458f900704ebd80d.tar.gz
Bug#12518
"COLUMN_DEFAULT has wrong value if NOT NULL is set" Show NULL instead of empty string when no default value is set
-rw-r--r--mysql-test/r/information_schema.result9
-rw-r--r--mysql-test/t/information_schema.test10
-rw-r--r--sql/sql_show.cc1
3 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index e0fb15a83c5..0a7f1af45f3 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -958,3 +958,12 @@ trigger_schema trigger_name
test tr1
use test;
drop table t1;
+create table t1 (a int not null, b int);
+use information_schema;
+select column_name, column_default from columns
+where table_schema='test' and table_name='t1';
+column_name column_default
+a NULL
+b NULL
+use test;
+drop table t1;
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 93b200b8a7c..d6d9f34302b 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -639,3 +639,13 @@ select trigger_schema, trigger_name from triggers where
trigger_name='tr1';
use test;
drop table t1;
+
+#
+# Bug#12518 COLUMN_DEFAULT has wrong value if NOT NULL is set
+#
+create table t1 (a int not null, b int);
+use information_schema;
+select column_name, column_default from columns
+ where table_schema='test' and table_name='t1';
+use test;
+drop table t1;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 760f5f7c456..c7a48c69cba 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2462,6 +2462,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
table->field[5]->set_notnull();
}
else if (field->unireg_check == Field::NEXT_NUMBER ||
+ lex->orig_sql_command != SQLCOM_SHOW_FIELDS ||
field->maybe_null())
table->field[5]->set_null(); // Null as default
else