[Commits] bzr commit into Mariadb 5.2, with Maria 2.0:maria/5.2 branch (igor:2834) Bug#610890

Igor Babaev igor at askmonty.org
Wed Jul 28 22:09:50 EEST 2010


#At lp:maria/5.2 based on revid:igor at askmonty.org-20100726220056-f0i7l8x3qtgi7pt5

 2834 Igor Babaev	2010-07-28
      Fixed bug #610890.
      The CREATE SHOW TABLE command misplaced virtual column specifiers:
      the AS clause for a virtual column was put before optional
      character set attributes, not after them as required by the syntax. 
      modified:
        mysql-test/suite/vcol/r/vcol_misc.result
        mysql-test/suite/vcol/t/vcol_misc.test
        sql/sql_show.cc

=== modified file 'mysql-test/suite/vcol/r/vcol_misc.result'
--- a/mysql-test/suite/vcol/r/vcol_misc.result	2010-07-26 22:00:56 +0000
+++ b/mysql-test/suite/vcol/r/vcol_misc.result	2010-07-28 19:09:38 +0000
@@ -125,3 +125,11 @@ a	p	ROUND(a,p)	ROUND(a,p+NULL)
 1	0	1	NULL
 0	NULL	NULL	NULL
 DROP TABLE t1;
+CREATE TABLE t1 (a char(32), v char(32) CHARACTER SET ucs2 AS (a) VIRTUAL);
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` char(32) DEFAULT NULL,
+  `v` char(32) CHARACTER SET ucs2 AS (a) VIRTUAL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;

=== modified file 'mysql-test/suite/vcol/t/vcol_misc.test'
--- a/mysql-test/suite/vcol/t/vcol_misc.test	2010-07-26 22:00:56 +0000
+++ b/mysql-test/suite/vcol/t/vcol_misc.test	2010-07-28 19:09:38 +0000
@@ -128,3 +128,13 @@ INSERT INTO t1(p,a) VALUES (0,1);
 INSERT INTO t1(p,a) VALUES (NULL,0);
 SELECT a, p, ROUND(a,p), ROUND(a,p+NULL) FROM t1;
 DROP TABLE t1;
+
+#
+# Bug#610890: SHOW CREATE TABLE with a virtual column
+#
+
+CREATE TABLE t1 (a char(32), v char(32) CHARACTER SET ucs2 AS (a) VIRTUAL);
+
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2010-07-19 18:08:06 +0000
+++ b/sql/sql_show.cc	2010-07-28 19:09:38 +0000
@@ -1348,19 +1348,6 @@ int store_create_info(THD *thd, TABLE_LI
     field->sql_type(type);
     packet->append(type.ptr(), type.length(), system_charset_info);
 
-    if (field->vcol_info)
-    {
-      packet->append(STRING_WITH_LEN(" AS ("));
-      packet->append(field->vcol_info->expr_str.str,
-                     field->vcol_info->expr_str.length,
-                     system_charset_info);
-      packet->append(STRING_WITH_LEN(")"));
-      if (field->stored_in_db)
-        packet->append(STRING_WITH_LEN(" PERSISTENT"));
-      else
-        packet->append(STRING_WITH_LEN(" VIRTUAL"));
-    }
-
     if (field->has_charset() &&
         !(thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)))
     {
@@ -1380,6 +1367,19 @@ int store_create_info(THD *thd, TABLE_LI
       }
     }
 
+    if (field->vcol_info)
+    {
+      packet->append(STRING_WITH_LEN(" AS ("));
+      packet->append(field->vcol_info->expr_str.str,
+                     field->vcol_info->expr_str.length,
+                     system_charset_info);
+      packet->append(STRING_WITH_LEN(")"));
+      if (field->stored_in_db)
+        packet->append(STRING_WITH_LEN(" PERSISTENT"));
+      else
+        packet->append(STRING_WITH_LEN(" VIRTUAL"));
+    }
+
     if (flags & NOT_NULL_FLAG)
       packet->append(STRING_WITH_LEN(" NOT NULL"));
     else if (field->type() == MYSQL_TYPE_TIMESTAMP)



More information about the commits mailing list