Bug #31122 Default column in show fields badly formatted
Submitted: 21 Sep 2007 0:43 Modified: 21 Oct 2007 4:27
Reporter: J Whitten Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Information schema Severity:S5 (Performance)
Version:5.0 something OS:Linux
Assigned to: CPU Architecture:Any

[21 Sep 2007 0:43] J Whitten
Description:
The default column would be more useful if whatever it contained were properly quoted in the manner for which it can be used. Its not worth trying to figure out / guess which items should be quoted because they're strings or not quoted because they're special-- ie. NULL, CURRENT_TIMESTAMP, etc. A default string of BLAH should be shown as: 'BLAH' instead of: BLAH. Conversely a default string of: CURRENT_TIMESTAMP should be shown as: CURRENT_TIMESTAMP, not 'CURRENT_TIMESTAMP'. Then someone could look at the column, scoop out the data, and be safe knowing they can just stick it directly into a field of that type and it will work.

How to repeat:
Visit the MySQL database near you and do something like (using information_schema database): select * from columns. If you have any default data for fields, you'll see it there.

Suggested fix:
Properly quote any item in the 'default value' (or whatever it is) field so that it can be copy & pasted into a field of the appropriate type.
[21 Sep 2007 4:27] Valeriy Kravchuk
Thank you for a problem report. Please, check with a newer version, 5.0.45, for example. I clearly see CURRENT_TIMESTAMP without any quotes in the results of:

select data_type, column_default from information_schema.columns;
[21 Oct 2007 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".