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

Error using first_value/last_value window function with aggregated function

    XMLWordPrintable

    Details

      Description

      create table t1 (a int);
      insert into t1 values (1), (2), (3);
       
      select  first_value(avg(a)) over () from t1;
      

      MariaDB [test]> select  first_value(avg(a)) over () from t1;
      ERROR 1111 (HY000): Invalid use of group function
      

      Mysql 8.0/Postgres 9.6:

      mysql> select  first_value(avg(a)) over () from t1;
      +-----------------------------+
      | first_value(avg(a)) over () |
      +-----------------------------+
      |                      2.0000 |
      +-----------------------------+
      1 row in set (0.00 sec)
      

        Attachments

          Activity

            People

            Assignee:
            varun Varun Gupta
            Reporter:
            alice Alice Sherepa
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: