Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-23656

view: removal of parentheses results in wrong result

    XMLWordPrintable

Details

    Description

      might be related to MDEV-13673:

      Parentheses in view were optimized out, which ends up in wrong result:

       
      mysql> create table t1 (a int, b decimal(10,2));
      Query OK, 0 rows affected (0,02 sec)
       
      mysql> insert into t1 values (1, 10.2);
      Query OK, 1 row affected (0,01 sec)
       
      mysql> create view v1 as select avg(b) / (2 + a) from t1;
      Query OK, 0 rows affected (0,00 sec)
       
      mysql> select * from v1;
      +------------------+
      | avg(b) / (2 + a) |
      +------------------+
      |     6.1000000000 |
      +------------------+
      1 row in set (0,00 sec)
       
      mysql> select avg(b) / (2 + a) from t1;
      +------------------+
      | avg(b) / (2 + a) |
      +------------------+
      |     3.4000000000 |
      +------------------+
      1 row in set (0,00 sec)
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              georg Georg Richter
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.