Hi, Peter! On Dec 30, Peter Laursen wrote:
Compare "generated columns" in MySQL 5.7.5 labs (refer http://mysqlserverteam.com/generated-columns-in-mysql-5-7-5/). It has instrumentation in SHOW and I_S. Please admit that this is a bug and an oversight from MariaDB to forget about this!
Agree, these could be useful. On the other hand, virtual columns were implemented in MariaDB-5.2, in 2010. And in these almost five years nobody ever requested these features for SHOW and I_S, as far as I remember. So, I don't believe I can be a judge of what is useful and what is not, I got it wrong oh so many times. Do you need these SHOW/I_S extensions? Please, create an issue in Jira for them, if you do. Regards, Sergei
Field Type Null Key
select version(); -- 5.7.5-labs-preview
create table comments( userid int AS (ExtractValue(comment,'/comment/userid')) STORED, comment TEXT, KEY(userid));
show columns from comments; /*Default Extra ------- ------- ------ ------ ------- --------- userid int(11) YES MUL (NULL) VIRTUAL comment text YES (NULL) */
describe comments; /* Field Type Null Key Default Extra ------- ------- ------ ------ ------- --------- userid int(11) YES MUL (NULL) VIRTUAL comment text YES (NULL) */
show full fields from comments; /* Field Type Collation Null Key Default Extra Privileges Comment ------- ------- ----------------- ------ ------ ------- ------- ------------------------------- --------- userid int(11) (NULL) YES MUL (NULL) VIRTUAL select,insert,update,references comment text latin1_swedish_ci YES (NULL) select,insert,update,references */
select * from information_schema.`COLUMNS` where TABLE_NAME = 'comments';
/* TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT GENERATION_EXPRESSION ------------- ------------ ---------- ----------- ---------------- -------------- ----------- --------- ------------------------ ---------------------- ----------------- ------------- ------------------ ------------------ ----------------- ----------- ---------- ------- ------------------------------- -------------- ----------------------------------------- def test comments userid 1 (NULL) YES int (NULL) (NULL) 10 0 (NULL) (NULL) (NULL) int(11) MUL VIRTUAL select,insert,update,references ExtractValue(comment,'/comment/userid') def test comments comment 2 (NULL) YES text 65535 65535 (NULL) (NULL) (NULL) latin1 latin1_swedish_ci text select,insert,update,references
*/