From: Tor Didriksen Date: August 26 2011 1:58pm Subject: bzr push into mysql-trunk branch (tor.didriksen:3405 to 3406) Bug#12763207 List-Archive: http://lists.mysql.com/commits/140813 X-Bug: 12763207 Message-Id: <201108261358.p7QDwxS0024249@acsmt357.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3406 Tor Didriksen 2011-08-26 Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER Followup patch. The previous patch assumed that Item_field::fix_fields would tag the select_lex with non_agg_field_used. Item_fields for subqueries of the form 'select * from view' do not go through fix_fields, but are created directly by Field_iterator_table::create_item, and added to the select->non_agg_fields list. The select_lex was however not tagged with the boolean flag. @ mysql-test/include/subquery.inc New test case. @ mysql-test/r/subquery_nomat_nosj.result New test case. @ mysql-test/r/subquery_nomat_nosj_bka.result New test case. @ mysql-test/r/subquery_nomat_nosj_bka_nobnl.result New test case. @ mysql-test/r/subquery_none.result New test case. @ mysql-test/r/subquery_none_bka.result New test case. @ mysql-test/r/subquery_none_bka_nobnl.result New test case. @ sql/table.cc Same logic as Item_field::fix_fields: if the item is pushed into select->non_agg_fields, then also tag the select_lex with set_non_agg_field_used(true). modified: mysql-test/include/subquery.inc mysql-test/r/subquery_nomat_nosj.result mysql-test/r/subquery_nomat_nosj_bka.result mysql-test/r/subquery_nomat_nosj_bka_nobnl.result mysql-test/r/subquery_none.result mysql-test/r/subquery_none_bka.result mysql-test/r/subquery_none_bka_nobnl.result sql/table.cc 3405 Tor Didriksen 2011-08-26 BUG#11755836, tests have now been re-enabled, so make them run without deterministic failure .... modified: mysql-test/suite/rpl/r/rpl_spec_variables.result mysql-test/suite/rpl/t/rpl_spec_variables.test === modified file 'mysql-test/include/subquery.inc' --- a/mysql-test/include/subquery.inc 2011-08-17 10:30:04 +0000 +++ b/mysql-test/include/subquery.inc 2011-08-26 13:26:33 +0000 @@ -4058,6 +4058,37 @@ SET SESSION sql_mode=@old_sql_mode; DROP TABLE t1, t2; +--echo # +--echo # Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER +--echo # + +create table t2(i int); +insert into t2 values(0); + +SELECT @@session.sql_mode INTO @old_sql_mode; +SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; + +CREATE VIEW v1 AS +SELECT 'f' FROM t2 UNION SELECT 'x' FROM t2 +; + +CREATE TABLE t1 ( + pk int NOT NULL, + col_varchar_key varchar(1) DEFAULT NULL, + PRIMARY KEY (pk), + KEY col_varchar_key (col_varchar_key) +); + +SELECT t1.pk +FROM t1 +WHERE t1.col_varchar_key < ALL ( SELECT * FROM v1 ) +; + +SET SESSION sql_mode=@old_sql_mode; + +drop table t2, t1; +drop view v1; + --echo End of 5.0 tests. # === modified file 'mysql-test/r/subquery_nomat_nosj.result' --- a/mysql-test/r/subquery_nomat_nosj.result 2011-08-19 11:39:15 +0000 +++ b/mysql-test/r/subquery_nomat_nosj.result 2011-08-26 13:26:33 +0000 @@ -5184,6 +5184,30 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 1 SET SESSION sql_mode=@old_sql_mode; DROP TABLE t1, t2; +# +# Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER +# +create table t2(i int); +insert into t2 values(0); +SELECT @@session.sql_mode INTO @old_sql_mode; +SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; +CREATE VIEW v1 AS +SELECT 'f' FROM t2 UNION SELECT 'x' FROM t2 +; +CREATE TABLE t1 ( +pk int NOT NULL, +col_varchar_key varchar(1) DEFAULT NULL, +PRIMARY KEY (pk), +KEY col_varchar_key (col_varchar_key) +); +SELECT t1.pk +FROM t1 +WHERE t1.col_varchar_key < ALL ( SELECT * FROM v1 ) +; +pk +SET SESSION sql_mode=@old_sql_mode; +drop table t2, t1; +drop view v1; End of 5.0 tests. create table t_out (subcase char(3), a1 char(2), b1 char(2), c1 char(2)); === modified file 'mysql-test/r/subquery_nomat_nosj_bka.result' --- a/mysql-test/r/subquery_nomat_nosj_bka.result 2011-08-19 11:41:38 +0000 +++ b/mysql-test/r/subquery_nomat_nosj_bka.result 2011-08-26 13:26:33 +0000 @@ -5185,6 +5185,30 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 1 SET SESSION sql_mode=@old_sql_mode; DROP TABLE t1, t2; +# +# Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER +# +create table t2(i int); +insert into t2 values(0); +SELECT @@session.sql_mode INTO @old_sql_mode; +SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; +CREATE VIEW v1 AS +SELECT 'f' FROM t2 UNION SELECT 'x' FROM t2 +; +CREATE TABLE t1 ( +pk int NOT NULL, +col_varchar_key varchar(1) DEFAULT NULL, +PRIMARY KEY (pk), +KEY col_varchar_key (col_varchar_key) +); +SELECT t1.pk +FROM t1 +WHERE t1.col_varchar_key < ALL ( SELECT * FROM v1 ) +; +pk +SET SESSION sql_mode=@old_sql_mode; +drop table t2, t1; +drop view v1; End of 5.0 tests. create table t_out (subcase char(3), a1 char(2), b1 char(2), c1 char(2)); === modified file 'mysql-test/r/subquery_nomat_nosj_bka_nobnl.result' --- a/mysql-test/r/subquery_nomat_nosj_bka_nobnl.result 2011-08-19 11:41:38 +0000 +++ b/mysql-test/r/subquery_nomat_nosj_bka_nobnl.result 2011-08-26 13:26:33 +0000 @@ -5185,6 +5185,30 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 1 SET SESSION sql_mode=@old_sql_mode; DROP TABLE t1, t2; +# +# Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER +# +create table t2(i int); +insert into t2 values(0); +SELECT @@session.sql_mode INTO @old_sql_mode; +SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; +CREATE VIEW v1 AS +SELECT 'f' FROM t2 UNION SELECT 'x' FROM t2 +; +CREATE TABLE t1 ( +pk int NOT NULL, +col_varchar_key varchar(1) DEFAULT NULL, +PRIMARY KEY (pk), +KEY col_varchar_key (col_varchar_key) +); +SELECT t1.pk +FROM t1 +WHERE t1.col_varchar_key < ALL ( SELECT * FROM v1 ) +; +pk +SET SESSION sql_mode=@old_sql_mode; +drop table t2, t1; +drop view v1; End of 5.0 tests. create table t_out (subcase char(3), a1 char(2), b1 char(2), c1 char(2)); === modified file 'mysql-test/r/subquery_none.result' --- a/mysql-test/r/subquery_none.result 2011-08-19 11:39:15 +0000 +++ b/mysql-test/r/subquery_none.result 2011-08-26 13:26:33 +0000 @@ -5183,6 +5183,30 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 1 SET SESSION sql_mode=@old_sql_mode; DROP TABLE t1, t2; +# +# Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER +# +create table t2(i int); +insert into t2 values(0); +SELECT @@session.sql_mode INTO @old_sql_mode; +SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; +CREATE VIEW v1 AS +SELECT 'f' FROM t2 UNION SELECT 'x' FROM t2 +; +CREATE TABLE t1 ( +pk int NOT NULL, +col_varchar_key varchar(1) DEFAULT NULL, +PRIMARY KEY (pk), +KEY col_varchar_key (col_varchar_key) +); +SELECT t1.pk +FROM t1 +WHERE t1.col_varchar_key < ALL ( SELECT * FROM v1 ) +; +pk +SET SESSION sql_mode=@old_sql_mode; +drop table t2, t1; +drop view v1; End of 5.0 tests. create table t_out (subcase char(3), a1 char(2), b1 char(2), c1 char(2)); === modified file 'mysql-test/r/subquery_none_bka.result' --- a/mysql-test/r/subquery_none_bka.result 2011-08-19 11:41:38 +0000 +++ b/mysql-test/r/subquery_none_bka.result 2011-08-26 13:26:33 +0000 @@ -5184,6 +5184,30 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 1 SET SESSION sql_mode=@old_sql_mode; DROP TABLE t1, t2; +# +# Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER +# +create table t2(i int); +insert into t2 values(0); +SELECT @@session.sql_mode INTO @old_sql_mode; +SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; +CREATE VIEW v1 AS +SELECT 'f' FROM t2 UNION SELECT 'x' FROM t2 +; +CREATE TABLE t1 ( +pk int NOT NULL, +col_varchar_key varchar(1) DEFAULT NULL, +PRIMARY KEY (pk), +KEY col_varchar_key (col_varchar_key) +); +SELECT t1.pk +FROM t1 +WHERE t1.col_varchar_key < ALL ( SELECT * FROM v1 ) +; +pk +SET SESSION sql_mode=@old_sql_mode; +drop table t2, t1; +drop view v1; End of 5.0 tests. create table t_out (subcase char(3), a1 char(2), b1 char(2), c1 char(2)); === modified file 'mysql-test/r/subquery_none_bka_nobnl.result' --- a/mysql-test/r/subquery_none_bka_nobnl.result 2011-08-19 11:41:38 +0000 +++ b/mysql-test/r/subquery_none_bka_nobnl.result 2011-08-26 13:26:33 +0000 @@ -5184,6 +5184,30 @@ SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 1 SET SESSION sql_mode=@old_sql_mode; DROP TABLE t1, t2; +# +# Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER +# +create table t2(i int); +insert into t2 values(0); +SELECT @@session.sql_mode INTO @old_sql_mode; +SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; +CREATE VIEW v1 AS +SELECT 'f' FROM t2 UNION SELECT 'x' FROM t2 +; +CREATE TABLE t1 ( +pk int NOT NULL, +col_varchar_key varchar(1) DEFAULT NULL, +PRIMARY KEY (pk), +KEY col_varchar_key (col_varchar_key) +); +SELECT t1.pk +FROM t1 +WHERE t1.col_varchar_key < ALL ( SELECT * FROM v1 ) +; +pk +SET SESSION sql_mode=@old_sql_mode; +drop table t2, t1; +drop view v1; End of 5.0 tests. create table t_out (subcase char(3), a1 char(2), b1 char(2), c1 char(2)); === modified file 'sql/table.cc' --- a/sql/table.cc 2011-08-24 14:47:26 +0000 +++ b/sql/table.cc 2011-08-26 13:26:33 +0000 @@ -4511,6 +4511,7 @@ Item *Field_iterator_table::create_item( { select->non_agg_fields.push_back(item); item->marker= select->cur_pos_in_select_list; + select->set_non_agg_field_used(true); } return item; } No bundle (reason: useless for push emails).