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

Wrong results when using STDDEV_SAMP() and view

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Confirmed (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.5, 10.1, 10.2, 10.3, 10.4, 10.0
    • Fix Version/s: 5.5, 10.1, 10.2, 10.3, 10.4, 10.0
    • Component/s: None
    • Labels:
      None

      Description

      create table t1(i int);
      insert into t1 values  (1),(2),(3),(4),(5);
       
      select stddev_samp(i) from t1;
      create view v1 as select stddev_samp(i) from t1;
      select * from v1;
      

      MariaDB [test]> select stddev_samp(i) from t1;
      +----------------+
      | stddev_samp(i) |
      +----------------+
      |         1.5811 |
      +----------------+
      1 row in set (0.001 sec)
       
      MariaDB [test]> create or replace view v1 as select stddev_samp(i) from t1;
      Query OK, 0 rows affected (0.009 sec)
       
      MariaDB [test]> select * from v1;
      +----------------+
      | stddev_samp(i) |
      +----------------+
      |         1.4142 |
      +----------------+
      1 row in set (0.002 sec)
      

      And with window function:

      create table t1(i int);
      insert into t1 values  (1),(2),(3),(4),(5);
       
      select stddev_samp(i) over (order by i) from t1;
      create view v1 as select stddev_samp(i) over (order by i) from t1;
      select * from v1;
      

      MariaDB [test]> select stddev_samp(i) over (order by i) from t1;
      +----------------------------------+
      | stddev_samp(i) over (order by i) |
      +----------------------------------+
      |                             NULL |
      |                           0.7071 |
      |                           1.0000 |
      |                           1.2910 |
      |                           1.5811 |
      +----------------------------------+
      5 rows in set (0.002 sec)
       
      MariaDB [test]> create view v1 as select stddev_samp(i) over (order by i) from t1;
      Query OK, 0 rows affected (0.007 sec)
       
      MariaDB [test]> select * from v1;
      +----------------------------------+
      | stddev_samp(i) over (order by i) |
      +----------------------------------+
      |                           0.0000 |
      |                           0.5000 |
      |                           0.8165 |
      |                           1.1180 |
      |                           1.4142 |
      +----------------------------------+
      5 rows in set (0.003 sec)
      
      

        Attachments

          Activity

            People

            Assignee:
            sanja Oleksandr Byelkin
            Reporter:
            alice Alice Sherepa
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: