diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2017-03-28 23:36:33 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2017-03-28 23:36:33 +0400 |
commit | da5c3e03f622a31626605cd43a8623d760caf5a8 (patch) | |
tree | a4f404ed4cfc1d8a3ff043df7ea941692f44e5d9 /sql/sql_show.cc | |
parent | 93dd70ced8919be8ff9df6581f5f1a509998b6ac (diff) | |
download | mariadb-git-da5c3e03f622a31626605cd43a8623d760caf5a8.tar.gz |
MDEV-9255 Add generation_expression to information_schema.columns.
Added IS_GENERATED and GENERATION_EXPRESSION columns required by
the SQL standard
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r-- | sql/sql_show.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 58fc2edc6f2..c45e27a2794 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -5505,13 +5505,24 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables, table->field[17]->store(STRING_WITH_LEN("auto_increment"), cs); if (print_on_update_clause(field, &type, true)) table->field[17]->store(type.ptr(), type.length(), cs); + if (field->vcol_info) { + String gen_s(tmp,sizeof(tmp), system_charset_info); + gen_s.length(0); + field->vcol_info->print(&gen_s); + table->field[21]->store(gen_s.ptr(), gen_s.length(), cs); + table->field[21]->set_notnull(); + table->field[20]->store(STRING_WITH_LEN("ALWAYS"), cs); + if (field->vcol_info->stored_in_db) table->field[17]->store(STRING_WITH_LEN("STORED GENERATED"), cs); else table->field[17]->store(STRING_WITH_LEN("VIRTUAL GENERATED"), cs); } + else + table->field[20]->store(STRING_WITH_LEN("NEVER"), cs); + table->field[19]->store(field->comment.str, field->comment.length, cs); if (schema_table_store_record(thd, table)) DBUG_RETURN(1); @@ -8444,6 +8455,9 @@ ST_FIELD_INFO columns_fields_info[]= {"PRIVILEGES", 80, MYSQL_TYPE_STRING, 0, 0, "Privileges", OPEN_FRM_ONLY}, {"COLUMN_COMMENT", COLUMN_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0, "Comment", OPEN_FRM_ONLY}, + {"IS_GENERATED", 6, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY}, + {"GENERATION_EXPRESSION", MAX_FIELD_VARCHARLENGTH, MYSQL_TYPE_STRING, 0, 1, + 0, OPEN_FRM_ONLY}, {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} }; |