diff options
author | Sergei Golubchik <serg@mariadb.org> | 2020-10-01 16:35:55 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2020-10-23 15:53:41 +0200 |
commit | 2cd5df8c83d018d1aa58c8426b8406c3c6528d7e (patch) | |
tree | e170d8775dae532c77795ca11f8aaa3ae60e13f5 /mysql-test | |
parent | 15f03c204159325c343bd8c793f71edad0be3347 (diff) | |
download | mariadb-git-2cd5df8c83d018d1aa58c8426b8406c3c6528d7e.tar.gz |
MDEV-23656 view: removal of parentheses results in wrong result
Item_ref should have the precedence of the item it's referencing
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/precedence_bugs.result | 13 | ||||
-rw-r--r-- | mysql-test/t/precedence_bugs.test | 10 |
2 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/r/precedence_bugs.result b/mysql-test/r/precedence_bugs.result new file mode 100644 index 00000000000..a9b1cd81503 --- /dev/null +++ b/mysql-test/r/precedence_bugs.result @@ -0,0 +1,13 @@ +# +# MDEV-23656 view: removal of parentheses results in wrong result +# +create table t1 (a int, b decimal(10,2)); +insert into t1 values (1, 10.2); +create view v1 as select avg(b) / (2 + a) from t1; +show create view v1; +View v1 +Create View CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select avg(`t1`.`b`) / (2 + `t1`.`a`) AS `avg(b) / (2 + a)` from `t1` +character_set_client latin1 +collation_connection latin1_swedish_ci +drop view v1; +drop table t1; diff --git a/mysql-test/t/precedence_bugs.test b/mysql-test/t/precedence_bugs.test new file mode 100644 index 00000000000..6e00fee41a5 --- /dev/null +++ b/mysql-test/t/precedence_bugs.test @@ -0,0 +1,10 @@ + +--echo # +--echo # MDEV-23656 view: removal of parentheses results in wrong result +--echo # +create table t1 (a int, b decimal(10,2)); +insert into t1 values (1, 10.2); +create view v1 as select avg(b) / (2 + a) from t1; +query_vertical show create view v1; +drop view v1; +drop table t1; |