summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-03-09 15:37:16 -0800
committerIgor Babaev <igor@askmonty.org>2012-03-09 15:37:16 -0800
commit8c083498828cf1c2df017b23fa50eda8e961b455 (patch)
tree1242c5a225ddf21da3f0f0435350c910ac9e4741
parent028523e94dfc89813cb36eb716fa66ea499055ff (diff)
downloadmariadb-git-8c083498828cf1c2df017b23fa50eda8e961b455.tar.gz
Fixed LP bug #930814.
This bug was introduced into mariadb 5.2 in the December 2010 with the patch that added a new engine property: the ability to support virtual columns. As a result of this bug the information from frm files for tables that contained virtual columns did not appear in the information schema tables.
-rw-r--r--mysql-test/suite/vcol/r/vcol_misc.result13
-rw-r--r--mysql-test/suite/vcol/t/vcol_misc.test14
-rw-r--r--sql/table.cc4
3 files changed, 29 insertions, 2 deletions
diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result
index e83a89c44c3..d5061fa4d5f 100644
--- a/mysql-test/suite/vcol/r/vcol_misc.result
+++ b/mysql-test/suite/vcol/r/vcol_misc.result
@@ -133,3 +133,16 @@ t1 CREATE TABLE `t1` (
`v` char(32) CHARACTER SET ucs2 AS (a) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
+CREATE TABLE t1 (a int, b int);
+CREATE TABLE t2 (a int, b int as (a+1) VIRTUAL);
+SELECT table_schema, table_name, column_name, column_type, extra
+FROM information_schema.columns WHERE table_name = 't1';
+table_schema table_name column_name column_type extra
+test t1 a int(11)
+test t1 b int(11)
+SELECT table_schema, table_name, column_name, column_type, extra
+FROM information_schema.columns WHERE table_name = 't2';
+table_schema table_name column_name column_type extra
+test t2 a int(11)
+test t2 b int(11) VIRTUAL
+DROP TABLE t1,t2;
diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test
index 2a8d9a576b4..495432fdb4c 100644
--- a/mysql-test/suite/vcol/t/vcol_misc.test
+++ b/mysql-test/suite/vcol/t/vcol_misc.test
@@ -140,3 +140,17 @@ CREATE TABLE t1 (a char(32), v char(32) CHARACTER SET ucs2 AS (a) VIRTUAL);
SHOW CREATE TABLE t1;
DROP TABLE t1;
+
+#
+# Bug#930814: no info in information schema for tables with virtual columns
+#
+
+CREATE TABLE t1 (a int, b int);
+CREATE TABLE t2 (a int, b int as (a+1) VIRTUAL);
+
+SELECT table_schema, table_name, column_name, column_type, extra
+ FROM information_schema.columns WHERE table_name = 't1';
+SELECT table_schema, table_name, column_name, column_type, extra
+ FROM information_schema.columns WHERE table_name = 't2';
+
+DROP TABLE t1,t2;
diff --git a/sql/table.cc b/sql/table.cc
index e576e5ae25f..5bcc85e3cc8 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -2339,8 +2339,8 @@ partititon_err:
/* Check virtual columns against table's storage engine. */
if (share->vfields &&
- !(outparam->file &&
- (outparam->file->ha_table_flags() & HA_CAN_VIRTUAL_COLUMNS)))
+ (outparam->file &&
+ !(outparam->file->ha_table_flags() & HA_CAN_VIRTUAL_COLUMNS)))
{
my_error(ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS, MYF(0),
plugin_name(share->db_plugin)->str);