Skip to content

Commit 888f685

Browse files
committed
MDEV-20210 If you have an INVISIBLE VIRTUAL column, SHOW CREATE TABLE doesn't list it as INVISIBLE
1 parent c93f96e commit 888f685

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

mysql-test/main/invisible_field_debug.result

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,3 +376,15 @@ SET debug_dbug="+d,test_completely_invisible,test_invisible_index";
376376
CREATE TABLE t2 LIKE t1;
377377
SET debug_dbug= DEFAULT;
378378
DROP TABLE t1, t2;
379+
#
380+
# MDEV-20210
381+
# If you have an INVISIBLE VIRTUAL column, SHOW CREATE TABLE doesn't list it as INVISIBLE
382+
#
383+
CREATE TABLE t1 (i INT, v int GENERATED ALWAYS AS (1) VIRTUAL INVISIBLE);
384+
SHOW CREATE TABLE t1;
385+
Table Create Table
386+
t1 CREATE TABLE `t1` (
387+
`i` int(11) DEFAULT NULL,
388+
`v` int(11) GENERATED ALWAYS AS (1) VIRTUAL INVISIBLE
389+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
390+
DROP TABLE t1;

mysql-test/main/invisible_field_debug.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,12 @@ SET debug_dbug="+d,test_completely_invisible,test_invisible_index";
278278
CREATE TABLE t2 LIKE t1;
279279
SET debug_dbug= DEFAULT;
280280
DROP TABLE t1, t2;
281+
282+
--echo #
283+
--echo # MDEV-20210
284+
--echo # If you have an INVISIBLE VIRTUAL column, SHOW CREATE TABLE doesn't list it as INVISIBLE
285+
--echo #
286+
287+
CREATE TABLE t1 (i INT, v int GENERATED ALWAYS AS (1) VIRTUAL INVISIBLE);
288+
SHOW CREATE TABLE t1;
289+
DROP TABLE t1;

sql/sql_show.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,6 +2256,10 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
22562256
packet->append(STRING_WITH_LEN(" STORED"));
22572257
else
22582258
packet->append(STRING_WITH_LEN(" VIRTUAL"));
2259+
if (field->invisible == INVISIBLE_USER)
2260+
{
2261+
packet->append(STRING_WITH_LEN(" INVISIBLE"));
2262+
}
22592263
}
22602264
else
22612265
{

0 commit comments

Comments
 (0)