mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
MDEV-23656 view: removal of parentheses results in wrong result
Item_ref should have the precedence of the item it's referencing
This commit is contained in:
parent
15f03c2041
commit
2cd5df8c83
3 changed files with 28 additions and 1 deletions
13
mysql-test/r/precedence_bugs.result
Normal file
13
mysql-test/r/precedence_bugs.result
Normal file
|
|
@ -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;
|
||||
10
mysql-test/t/precedence_bugs.test
Normal file
10
mysql-test/t/precedence_bugs.test
Normal file
|
|
@ -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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue