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

Igor Babaev igor at askmonty.org
Tue Jul 20 22:38:59 EEST 2010


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

 2827 Igor Babaev	2010-07-20
      Fixed bug #607168.
      The command CREATE TABLE AS SELECT erroneously preserved the virtual
      properties of the virtual fields from the select list. 
      modified:
        mysql-test/suite/vcol/r/vcol_misc.result
        mysql-test/suite/vcol/t/vcol_misc.test
        sql/sql_select.cc

=== modified file 'mysql-test/suite/vcol/r/vcol_misc.result'
--- a/mysql-test/suite/vcol/r/vcol_misc.result	2010-07-17 19:58:08 +0000
+++ b/mysql-test/suite/vcol/r/vcol_misc.result	2010-07-20 19:38:46 +0000
@@ -87,3 +87,11 @@ a	v
 2002-02-15 00:00:00	0
 2000-10-15 00:00:00	1
 DROP TABLE t1, t2;
+CREATE TABLE t1 (f1 INTEGER, v1 INTEGER AS (f1) VIRTUAL);
+CREATE TABLE t2 AS SELECT v1 FROM t1;
+SHOW CREATE TABLE t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `v1` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;

=== modified file 'mysql-test/suite/vcol/t/vcol_misc.test'
--- a/mysql-test/suite/vcol/t/vcol_misc.test	2010-07-17 19:58:08 +0000
+++ b/mysql-test/suite/vcol/t/vcol_misc.test	2010-07-20 19:38:46 +0000
@@ -87,3 +87,13 @@ INSERT INTO t2(a) VALUES ('2000-10-15');
 SELECT * FROM t2;
 
 DROP TABLE t1, t2;
+
+#
+# Bug#607168: CREATE TABLE AS SELECT that returns virtual columns
+#
+
+CREATE TABLE t1 (f1 INTEGER, v1 INTEGER AS (f1) VIRTUAL);
+CREATE TABLE t2 AS SELECT v1 FROM t1;
+SHOW CREATE TABLE t2;
+
+DROP TABLE t1,t2;

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2010-07-17 19:58:08 +0000
+++ b/sql/sql_select.cc	2010-07-20 19:38:46 +0000
@@ -9564,6 +9564,8 @@ Field *create_tmp_field_from_field(THD *
       table->s->db_create_options|= HA_OPTION_PACK_RECORD;
     else if (org_field->type() == FIELD_TYPE_DOUBLE)
       ((Field_double *) new_field)->not_fixed= TRUE;
+    new_field->vcol_info= 0;
+    new_field->stored_in_db= TRUE;
   }
   return new_field;
 }



More information about the commits mailing list