summaryrefslogtreecommitdiff
path: root/mysql-test/t/view.test
diff options
context:
space:
mode:
authorunknown <igor@olga.mysql.com>2007-01-17 20:13:45 -0800
committerunknown <igor@olga.mysql.com>2007-01-17 20:13:45 -0800
commitaf3216862354eea44e594eb9216252c7b260fb3e (patch)
tree5c9fbe39dd901f2e87ebe248ac26c2bde025d765 /mysql-test/t/view.test
parent759a028c20412d26802d479724de932a288a3e43 (diff)
downloadmariadb-git-af3216862354eea44e594eb9216252c7b260fb3e.tar.gz
Fixed bug #25580: incorrect stored representations of views in cases
when they contain the '!' operator. Added an implementation for the method Item_func_not::print. The method encloses any NOT expression into extra parentheses to avoid incorrect stored representations of views that use the '!' operators. Without this change when a view was created that contained the expression !0*5 its stored representation contained not this expression but rather the expression not(0)*5 . The operator '!' is of a higher precedence than '*', while NOT is of a lower precedence than '*'. That's why the expression !0*5 is interpreted as not(0)*5, while the expression not(0)*5 is interpreted as not((0)*5) unless sql_mode is set to HIGH_NOT_PRECEDENCE. Now we translate !0*5 into (not(0))*5. mysql-test/r/sp-code.result: Adjusted results after the fix of bug 25580. mysql-test/r/subselect.result: Adjusted results after the fix of bug 25580. mysql-test/r/view.result: Added a test case for bug #25580. mysql-test/t/view.test: Added a test case for bug #25580. sql/item_cmpfunc.cc: Fixed bug #25580: incorrect stored representations of views in cases when they contain the '!' operator. Added an implementation for the method Item_func_not::print. The method encloses the NOT expression into extra parenthesis to avoid incorrect stored representations of views that use the '!' operators. sql/item_cmpfunc.h: Fixed bug #25580: incorrect stored representations of views in cases when they contain the '!' operator. Added an implementation for the method Item_func_not::print. The method encloses the NOT expression into extra parenthesis to avoid incorrect stored representations of views that use the '!' operators.
Diffstat (limited to 'mysql-test/t/view.test')
-rw-r--r--mysql-test/t/view.test11
1 files changed, 11 insertions, 0 deletions
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 8473458ae15..123759ec82e 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -2959,5 +2959,16 @@ SELECT * FROM t1;
DROP VIEW v1, v2;
DROP TABLE t1;
+#
+# Bug #25580: !0 as an operand in a select expression of a view
+#
+
+CREATE VIEW v AS SELECT !0 * 5 AS x FROM DUAL;
+SHOW CREATE VIEW v;
+
+SELECT !0 * 5 AS x FROM DUAL;
+SELECT * FROM v;
+
+DROP VIEW v;
--echo End of 5.0 tests.