Bug #1600 column's default value should be provided in a clean way
Submitted: 19 Oct 2003 11:30 Modified: 21 Dec 2005 12:30
Reporter: Paisa Seeluangsawat Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:any OS:Any (any)
Assigned to: CPU Architecture:Any

[19 Oct 2003 11:30] Paisa Seeluangsawat
Description:
Why should MYSQL_FIELD::def be set only by mysql_list_fields()?  This function's reference says its use is discauraged in favor of 'SHOW COLUMNS FROM table_name', which then you have to parse the result to know which column give you default values.  It gets even more messy once the query spans multiple tables.  Just retrieving columns' default values shouldn't get this complicated!

BTW, thanks for great work on MySQL :-).

How to repeat:
Look in section 11.1.1 and 11.1.3.34 of MySQL manual.

Suggested fix:
Have mysql_fetch_field() and similar functions set MYSQL_FIELD::def.
[21 Dec 2005 12:30] Valeriy Kravchuk
Thank you for a feature request. 

You may try to use SELECT ... FROM INFORMATION_SCHEMA.COLUMNS ... in version 5.0 (http://dev.mysql.com/doc/refman/5.0/en/columns-table.html) to get only default values and only for the columns you are interested in.