Re: mysql_fetch_field_direct() bug?
What client library version do you use? Perhaps you're looking at the headers from 4.1, and using the server or the client of an earlier release.
This is the code that unpacks fields in 4.1 and later, and I also checked the server part, it saves the original table name in the metadata packet:
if (server_capabilities & CLIENT_PROTOCOL_41)
{
/* server is 4.1, and returns the new field result format */
for (row=data->data; row ; row = row->next,field++)
{
uchar *pos;
cli_fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7);
field->catalog = strdup_root(alloc,(char*) row->data[0]);
field->db = strdup_root(alloc,(char*) row->data[1]);
field->table = strdup_root(alloc,(char*) row->data[2]);
field->org_table= strdup_root(alloc,(char*) row->data[3]);
field->name = strdup_root(alloc,(char*) row->data[4]);
field->org_name = strdup_root(alloc,(char*) row->data[5]);
You can see, that the original table name is unpacked all right. If you are able to repeat the problem against 4.1 (and later) client and server, please file a bug report.