Loading mysql-test/r/subselect.result +6 −6 Original line number Diff line number Diff line Loading @@ -1087,24 +1087,24 @@ CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL default '0', `(SELECT 1)` bigint(20) NOT NULL default '0' `a` bigint(1) NOT NULL default '0', `(SELECT 1)` bigint(1) NOT NULL default '0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL default '0', `(SELECT a)` bigint(20) NOT NULL default '0' `a` bigint(1) NOT NULL default '0', `(SELECT a)` bigint(1) NOT NULL default '0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL default '0', `(SELECT a+0)` bigint(20) NOT NULL default '0' `a` bigint(1) NOT NULL default '0', `(SELECT a+0)` bigint(3) NOT NULL default '0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a; Loading mysql-test/r/view.result +12 −1 Original line number Diff line number Diff line Loading @@ -566,7 +566,7 @@ select * from v1; col1 describe v1; Field Type Null Key Default Extra col1 varchar(2) YES NULL col1 char(2) YES NULL drop view v1; drop table `t1a``b`; create table t1 (col1 char(5),col2 char(5)); Loading Loading @@ -2007,6 +2007,17 @@ A B DROP VIEW v1; DROP TABLE t1; create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime); create view v1 as select * from t1; desc v1; Field Type Null Key Default Extra f1 tinyint(1) YES NULL f2 char(1) YES NULL f3 varchar(1) YES NULL f4 geometry YES NULL f5 datetime YES NULL drop view v1; drop table t1; CREATE TABLE t1 ( bug_table_seq INTEGER NOT NULL); CREATE OR REPLACE VIEW v1 AS SELECT * from t1; DROP PROCEDURE IF EXISTS p1; Loading mysql-test/r/view_grant.result +4 −4 Original line number Diff line number Diff line Loading @@ -72,12 +72,12 @@ select c from mysqltest.v4; c show columns from mysqltest.v1; Field Type Null Key Default Extra c bigint(20) YES NULL d bigint(20) YES NULL c bigint(12) YES NULL d bigint(12) YES NULL show columns from mysqltest.v2; Field Type Null Key Default Extra c bigint(20) YES NULL d bigint(20) YES NULL c bigint(12) YES NULL d bigint(12) YES NULL explain select c from mysqltest.v1; ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v1; Loading mysql-test/t/view.test +9 −0 Original line number Diff line number Diff line Loading @@ -1855,6 +1855,15 @@ DROP PROCEDURE p1; DROP VIEW v1; DROP TABLE t1; # # Bug #11335 View redefines column types # create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime); create view v1 as select * from t1; desc v1; drop view v1; drop table t1; # # Bug #11760 Typo in Item_func_add_time::print() results in NULLs returned # subtime() in view Loading sql/item_sum.cc +16 −0 Original line number Diff line number Diff line Loading @@ -321,6 +321,22 @@ Field *Item_sum_hybrid::create_tmp_field(bool group, TABLE *table, field->flags&= ~NOT_NULL_FLAG; return field; } /* DATE/TIME fields have STRING_RESULT result types. In order to preserve field type, it's needed to handle DATE/TIME fields creations separately. */ switch (args[0]->field_type()) { case MYSQL_TYPE_DATE: return new Field_date(maybe_null, name, table, collation.collation); case MYSQL_TYPE_TIME: return new Field_time(maybe_null, name, table, collation.collation); case MYSQL_TYPE_TIMESTAMP: case MYSQL_TYPE_DATETIME: return new Field_datetime(maybe_null, name, table, collation.collation); default: break; } return Item_sum::create_tmp_field(group, table, convert_blob_length); } Loading Loading
mysql-test/r/subselect.result +6 −6 Original line number Diff line number Diff line Loading @@ -1087,24 +1087,24 @@ CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL default '0', `(SELECT 1)` bigint(20) NOT NULL default '0' `a` bigint(1) NOT NULL default '0', `(SELECT 1)` bigint(1) NOT NULL default '0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL default '0', `(SELECT a)` bigint(20) NOT NULL default '0' `a` bigint(1) NOT NULL default '0', `(SELECT a)` bigint(1) NOT NULL default '0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL default '0', `(SELECT a+0)` bigint(20) NOT NULL default '0' `a` bigint(1) NOT NULL default '0', `(SELECT a+0)` bigint(3) NOT NULL default '0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a; Loading
mysql-test/r/view.result +12 −1 Original line number Diff line number Diff line Loading @@ -566,7 +566,7 @@ select * from v1; col1 describe v1; Field Type Null Key Default Extra col1 varchar(2) YES NULL col1 char(2) YES NULL drop view v1; drop table `t1a``b`; create table t1 (col1 char(5),col2 char(5)); Loading Loading @@ -2007,6 +2007,17 @@ A B DROP VIEW v1; DROP TABLE t1; create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime); create view v1 as select * from t1; desc v1; Field Type Null Key Default Extra f1 tinyint(1) YES NULL f2 char(1) YES NULL f3 varchar(1) YES NULL f4 geometry YES NULL f5 datetime YES NULL drop view v1; drop table t1; CREATE TABLE t1 ( bug_table_seq INTEGER NOT NULL); CREATE OR REPLACE VIEW v1 AS SELECT * from t1; DROP PROCEDURE IF EXISTS p1; Loading
mysql-test/r/view_grant.result +4 −4 Original line number Diff line number Diff line Loading @@ -72,12 +72,12 @@ select c from mysqltest.v4; c show columns from mysqltest.v1; Field Type Null Key Default Extra c bigint(20) YES NULL d bigint(20) YES NULL c bigint(12) YES NULL d bigint(12) YES NULL show columns from mysqltest.v2; Field Type Null Key Default Extra c bigint(20) YES NULL d bigint(20) YES NULL c bigint(12) YES NULL d bigint(12) YES NULL explain select c from mysqltest.v1; ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table show create view mysqltest.v1; Loading
mysql-test/t/view.test +9 −0 Original line number Diff line number Diff line Loading @@ -1855,6 +1855,15 @@ DROP PROCEDURE p1; DROP VIEW v1; DROP TABLE t1; # # Bug #11335 View redefines column types # create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime); create view v1 as select * from t1; desc v1; drop view v1; drop table t1; # # Bug #11760 Typo in Item_func_add_time::print() results in NULLs returned # subtime() in view Loading
sql/item_sum.cc +16 −0 Original line number Diff line number Diff line Loading @@ -321,6 +321,22 @@ Field *Item_sum_hybrid::create_tmp_field(bool group, TABLE *table, field->flags&= ~NOT_NULL_FLAG; return field; } /* DATE/TIME fields have STRING_RESULT result types. In order to preserve field type, it's needed to handle DATE/TIME fields creations separately. */ switch (args[0]->field_type()) { case MYSQL_TYPE_DATE: return new Field_date(maybe_null, name, table, collation.collation); case MYSQL_TYPE_TIME: return new Field_time(maybe_null, name, table, collation.collation); case MYSQL_TYPE_TIMESTAMP: case MYSQL_TYPE_DATETIME: return new Field_datetime(maybe_null, name, table, collation.collation); default: break; } return Item_sum::create_tmp_field(group, table, convert_blob_length); } Loading