diff options
author | Alexander Barkov <bar@mariadb.org> | 2016-01-16 18:45:26 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2016-01-16 18:45:26 +0400 |
commit | 7b50447aa6d051b8d14bb01ef14802cb8ffee223 (patch) | |
tree | 551c3240ca2ebb227ebc5735157e6d97b0ce6501 /mysql-test/r/view.result | |
parent | 98b6026036913bed65b6e121c86580ebd92bd715 (diff) | |
download | mariadb-git-7b50447aa6d051b8d14bb01ef14802cb8ffee223.tar.gz |
MDEV-9407 Illegal mix of collation when using GROUP_CONCAT in a VIEW
MDEV-9408 CREATE TABLE SELECT MAX(int_column) creates different columns for table vs view
There were three almost identical pieces of the code:
- Field *Item_func::tmp_table_field();
- Field *Item_sum::create_tmp_field();
- Field *create_tmp_field_from_item();
with a difference in very small details (hence the bugs):
Only Item_func::tmp_table_field() was correct, the other two were not.
Removing the two incorrect pieces of the redundant code.
Joining these three functions/methods into a single virtual method
Item::create_tmp_field().
Additionally, moving Item::make_string_field() and
Item::tmp_table_field_from_field_type() from the public into the
protected section of the class declaration, as they are now not
needed outside of Item.
Diffstat (limited to 'mysql-test/r/view.result')
-rw-r--r-- | mysql-test/r/view.result | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index dec85fbcd4b..01a06fad00d 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -5878,3 +5878,39 @@ DROP TABLE t1; # # End of 10.1 tests # +# +# Start of 10.2 tests +# +# +# MDEV-9408 CREATE TABLE SELECT MAX(int_column) creates different columns for table vs view +# +CREATE TABLE t1 ( +id int(11) NOT NULL PRIMARY KEY, +country varchar(32), +code int(11) default NULL +); +INSERT INTO t1 VALUES (1,'ITALY',100),(2,'ITALY',200),(3,'FRANCE',100), (4,'ITALY',100); +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE TABLE t2 AS +SELECT code, COUNT(DISTINCT country), MAX(id) FROM t1 GROUP BY code ORDER BY MAX(id); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `code` int(11) DEFAULT NULL, + `COUNT(DISTINCT country)` bigint(21) NOT NULL, + `MAX(id)` int(11) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t3 AS +SELECT code, COUNT(DISTINCT country), MAX(id) FROM v1 GROUP BY code ORDER BY MAX(id); +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `code` int(11) DEFAULT NULL, + `COUNT(DISTINCT country)` bigint(21) NOT NULL, + `MAX(id)` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP VIEW v1; +DROP TABLE t1,t2,t3; +# +# End of 10.2 tests +# |