Bug #10967 SHOW COLUMNS FROM does not return NULL for no DEFAULT value
Description:
SHOW [FULL] COLUMNS FROM makes it impossible to distinguish between no default value and '' as default value for string and other types. It works for numeric types.
Same in the information schema.
How to repeat:
DROP TABLE IF EXISTS `test`.`pic`;
CREATE TABLE `pic` (
`idpic` int(10) unsigned NOT NULL auto_increment,
`caption` varchar(45) NOT NULL,
`img` longblob NOT NULL,
PRIMARY KEY (`idpic`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
mysql> SHOW COLUMNS FROM test.pic;
+---------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+------------------+------+-----+---------+----------------+
| idpic | int(10) unsigned | NO | PRI | NULL | auto_increment |
| caption | varchar(45) | NO | | | |
| img | longblob | NO | | | |
+---------+------------------+------+-----+---------+----------------+
All rows should show NULL in the Default column.
SELECT column_name, column_default
FROM information_schema.columns C, information_schema.tables t
WHERE c.table_schema=t.table_schema AND
c.table_name=t.table_name AND
t.table_schema='test' AND
t.table_name='pic';
+-------------+----------------+
| column_name | column_default |
+-------------+----------------+
| idpic | NULL |
| caption | |
| img | |
+-------------+----------------+
Same thing.
Suggested fix:
Return NULL if no DEFAULT value exists in all cases.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.053 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.