Bug #33716 INFORMATION_SCHEMA.COLUMNS.COLUMN_DEFAULT reports incorrect value
Submitted: 7 Jan 2008 0:45 Modified: 7 Jan 2008 9:31
Reporter: Ryan Lowe Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Information schema Severity:S2 (Serious)
Version:5.0.45 OS:Any
Assigned to: CPU Architecture:Any
Tags: COLUMN_DEFAULT, information_schema

[7 Jan 2008 0:45] Ryan Lowe
Description:
INFORMATION_SCHEMA.COLUMNS.COLUMN_DEFAULT shows NULL as a column's default value where it is explicitly created NOT NULL, whereas SHOW COLUMNS FROM reports that the default value is an empty string ('').  The bug here is that information_schema.columns.column_default should also show an empty string.  

mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 5.0.45    | 
+-----------+
1 row in set (0.03 sec)

mysql> create table default_test (
    ->   id int(10) unsigned not null auto_increment primary key,
    ->   notnull_vc varchar(255) not null,
    ->   null_vc varchar(255));
Query OK, 0 rows affected (0.46 sec)

mysql> show columns from default_test;
+------------+------------------+------+-----+---------+----------------+
| Field      | Type             | Null | Key | Default | Extra          |
+------------+------------------+------+-----+---------+----------------+
| id         | int(10) unsigned | NO   | PRI | NULL    | auto_increment | 
| notnull_vc | varchar(255)     | NO   |     |         |                | 
| null_vc    | varchar(255)     | YES  |     | NULL    |                | 
+------------+------------------+------+-----+---------+----------------+
3 rows in set (0.17 sec)

mysql> select column_name as field, column_type as type, is_nullable as `Null`, column_key as `Key`, column_default as `Default`, extra from information_schema.columns where table_name='default_test';
+------------+------------------+------+-----+---------+----------------+
| field      | type             | Null | Key | Default | extra          |
+------------+------------------+------+-----+---------+----------------+
| id         | int(10) unsigned | NO   | PRI | NULL    | auto_increment | 
| notnull_vc | varchar(255)     | NO   |     | NULL    |                | 
| null_vc    | varchar(255)     | YES  |     | NULL    |                | 
+------------+------------------+------+-----+---------+----------------+
3 rows in set (0.09 sec)

There is another, similar, bug (26544), but not exact.

How to repeat:
Execute the SQL above.
[7 Jan 2008 9:31] Valeriy Kravchuk
Thank you for a problem report. I think this is a duplicate of bug you mentioned and/or related bug #26849. Let the developers decide what behaviour is correct and consistent.