The command CREATE TABLE AS SELECT erroneously preserved the virtual
properties of the virtual fields from the select list.
This commit is contained in:
Igor Babaev 2010-07-20 12:38:46 -07:00
parent 4f564a5443
commit b6e05df365
3 changed files with 20 additions and 0 deletions

View File

@ -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;

View File

@ -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;

View File

@ -9564,6 +9564,8 @@ Field *create_tmp_field_from_field(THD *thd, Field *org_field,
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;
}