Beware of the fact that the ->def property NEVER gets filled with the correct default field value, so it's totally USELESS.
This happens NOT for a bug in php (so don't go filling in a bug report), but happens BY DESIGN, since the MySQL C API call doesn't fill in this value, unless you call the mysql_list_fields() function, which Php doesn't.
See here for reference.
http://dev.mysql.com/doc/refman/5.0/en/c-api-datatypes.html
Also, be aware that if you're using a query which contains subqueries, the primary key/autoincrement flags do NOT get passed along, even if the field you're looking at is the primary autoincrement key of the master table:
SELECT * from (SELECT id from areas) AS subareas
and you'll find primary key and autoinc flags off on id field, even if id was the primary autoinc key of areas table.
This also is by design, i think, since it's supposed that if we're using a subquery then the primary key/autoinc stuff might have no sense at all, since in the result set we can compose fileds from many different tables.
Hoping this is useful, bye!