From 20a2e1d0ac46e375ee7246576b541624c6f8f028 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 21 Jul 2011 11:20:55 +0300 Subject: Fix of LP BUG#777809 There are 2 volatile condition constructions AND/OR constructions and fields(references) when first good supported to be top elements of conditions because it is normal practice (see copy_andor_structure for example) fields without any expression in the condition is really rare and mostly useless case however it could lead to problems when optimiser changes/moves them unaware of other variables referring to them. An easy solution of this problem is just to replace single field in a condition with equivalent expression well supported by the server ( -> != 0). mysql-test/r/view.result: New test added. mysql-test/t/view.test: New test added. sql/sql_parse.cc: -> != 0 sql/sql_yacc.yy: -> != 0 --- mysql-test/r/view.result | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'mysql-test/r/view.result') diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 80f19bd2fa9..93ebb3365b4 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -3906,6 +3906,23 @@ SELECT * FROM v1; a DROP VIEW v1; DROP TABLE t1; +# +# LP BUG#777809 (a retrograded condition for view ON) +# +CREATE TABLE t1 ( f1 int NOT NULL , f6 int NOT NULL ) ; +INSERT IGNORE INTO t1 VALUES (20, 2); +CREATE TABLE t2 ( f3 int NOT NULL ) ; +INSERT IGNORE INTO t2 VALUES (7); +CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2; +PREPARE prep_stmt FROM 'SELECT t1.f6 FROM t1 RIGHT JOIN v2 ON v2.f3 WHERE t1.f1 != 0'; +EXECUTE prep_stmt; +f6 +2 +EXECUTE prep_stmt; +f6 +2 +drop view v2; +drop table t1,t2; # ----------------------------------------------------------------- # -- End of 5.1 tests. # ----------------------------------------------------------------- -- cgit v1.2.1 From ee06e4d65e42d303389605f3d30cbf0892be96af Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 21 Jul 2011 12:29:00 +0300 Subject: Removed incorrect fix and its test suite (the test suit is duplicate). Fixed explains of previous patch. mysql-test/r/explain.result: Fixed explains of previous patch. mysql-test/r/join_outer.result: Fixed explains of previous patch. mysql-test/r/negation_elimination.result: Fixed explains of previous patch. mysql-test/r/view.result: Fixed explains of previous patch. mysql-test/suite/innodb/r/innodb_mysql.result: Removed duplicate test suite. mysql-test/suite/innodb/t/innodb_mysql.test: Removed duplicate test suite. mysql-test/suite/innodb_plugin/r/innodb_mysql.result: Removed duplicate test suite. mysql-test/suite/innodb_plugin/t/innodb_mysql.test: Removed duplicate test suite. sql/opt_range.h: Removed incorrect fix. sql/records.cc: Removed incorrect fix. --- mysql-test/r/view.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test/r/view.result') diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 93ebb3365b4..40142c5e0a7 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -3711,7 +3711,7 @@ CREATE TABLE t1 (c INT); CREATE VIEW v1 (view_column) AS SELECT c AS alias FROM t1 HAVING alias; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`c` AS `view_column` from `t1` having `view_column` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`c` AS `view_column` from `t1` having (`view_column` <> 0) latin1 latin1_swedish_ci SELECT * FROM v1; view_column -- cgit v1.2.1