Bug #78895 Lack information about generated columns in mysql_fetch_fields function
Submitted: 21 Oct 2015 9:46 Modified: 21 Oct 2015 10:08
Reporter: Milosz Bodzek Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:5.7.8,5.7.9 OS:Any
Assigned to: CPU Architecture:Any

[21 Oct 2015 9:46] Milosz Bodzek
Description:
There is no way to figure out that column is *Generated Column* using function mysql_fetch_fields.

How to repeat:
Create test table with generated column f.e.:

CREATE TABLE `collection1` (
  `doc` json DEFAULT NULL,
  `_id` varchar(32) GENERATED ALWAYS AS (JSON_UNQUOTE(JSON_EXTRACT(doc, '$._id'))) STORED
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Then try to get details about each column by call mysql_fetch_fields function, returned value don't contain information if column is generated.

Suggested fix:
Add one more flag to flags field - GENERATED_FLAG.
[21 Oct 2015 10:08] MySQL Verification Team
Hello Milosz,

Thank you for the report.

Thanks,
Umesh