mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
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 (<field> -> <field> != 0). mysql-test/r/view.result: New test added. mysql-test/t/view.test: New test added. sql/sql_parse.cc: <field> -> <field> != 0 sql/sql_yacc.yy: <field> -> <field> != 0
This commit is contained in:
@ -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.
|
||||
# -----------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user