diff options
author | Igor Babaev <igor@askmonty.org> | 2011-06-21 18:00:58 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2011-06-21 18:00:58 -0700 |
commit | e7578ac612f73039ea9b212de4c7bcaa8e7d874e (patch) | |
tree | 00619cd875c1c17069c6b5291371e420a9c4d54e /mysql-test/r/view.result | |
parent | 44570d2b12c4898861a13b764bdc4bdf28c0dda4 (diff) | |
download | mariadb-git-e7578ac612f73039ea9b212de4c7bcaa8e7d874e.tar.gz |
Fixed LP bug #798621.
The patch for bugs 717577 and 724942 has missed to make adjustments for the
call item_equal->add_const(const_item, orig_field_item) in the function
check_simple_equality that builds multiple equality for a field and a constant.
As a result, when this field happens to be a view field and the corresponding
Item_field object F is wrapped in an Item_direct_view_ref object R the object
F is placed in the multiple equality instead of the object R.
A substitution of an equal item for F potentially can cause very serious
problems and in some cases can lead to crashes of the server.
Diffstat (limited to 'mysql-test/r/view.result')
-rw-r--r-- | mysql-test/r/view.result | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 9f720019303..fca298125ca 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -4184,3 +4184,26 @@ DELETE FROM v3; ERROR HY000: The target table v3 of the DELETE is not updatable DROP VIEW v1,v2,v3; DROP TABLE t1; +# +# Bug#798621: crash with a view string field equal +# to a constant +# +CREATE TABLE t1 (a varchar(32), b int) ; +INSERT INTO t1 VALUES ('j', NULL), ('c', 8), ('c', 1); +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE TABLE t2 (a varchar(32)) ; +INSERT INTO t2 VALUES ('j'), ('c'); +SELECT * FROM v1 LEFT JOIN t2 ON t2.a = v1.a +WHERE v1.b = 1 OR v1.a = 'a' AND LENGTH(v1.a) >= v1.b; +a b a +c 1 c +EXPLAIN EXTENDED +SELECT * FROM v1 LEFT JOIN t2 ON t2.a = v1.a +WHERE v1.b = 1 OR v1.a = 'a' AND LENGTH(v1.a) >= v1.b; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` left join `test`.`t2` on((`test`.`t2`.`a` = `test`.`t1`.`a`)) where ((`test`.`t1`.`b` = 1) or ((`test`.`t1`.`a` = 'a') and (length(`test`.`t1`.`a`) >= `test`.`t1`.`b`))) +DROP VIEW v1; +DROP TABLE t1,t2; |