Commit b6e05df3 authored by Igor Babaev's avatar Igor Babaev

Fixed bug #607168.

The command CREATE TABLE AS SELECT erroneously preserved the virtual
properties of the virtual fields from the select list. 
parent 4f564a54
...@@ -87,3 +87,11 @@ a v ...@@ -87,3 +87,11 @@ a v
2002-02-15 00:00:00 0 2002-02-15 00:00:00 0
2000-10-15 00:00:00 1 2000-10-15 00:00:00 1
DROP TABLE t1, t2; 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;
...@@ -87,3 +87,13 @@ INSERT INTO t2(a) VALUES ('2000-10-15'); ...@@ -87,3 +87,13 @@ INSERT INTO t2(a) VALUES ('2000-10-15');
SELECT * FROM t2; SELECT * FROM t2;
DROP TABLE t1, 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;
...@@ -9564,6 +9564,8 @@ Field *create_tmp_field_from_field(THD *thd, Field *org_field, ...@@ -9564,6 +9564,8 @@ Field *create_tmp_field_from_field(THD *thd, Field *org_field,
table->s->db_create_options|= HA_OPTION_PACK_RECORD; table->s->db_create_options|= HA_OPTION_PACK_RECORD;
else if (org_field->type() == FIELD_TYPE_DOUBLE) else if (org_field->type() == FIELD_TYPE_DOUBLE)
((Field_double *) new_field)->not_fixed= TRUE; ((Field_double *) new_field)->not_fixed= TRUE;
new_field->vcol_info= 0;
new_field->stored_in_db= TRUE;
} }
return new_field; return new_field;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment