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

Error with aggregate function inside of last_value() window function

    XMLWordPrintable

    Details

      Description

      CREATE TABLE t(i int,j int);
      INSERT INTO t VALUES (1,1), (1,5),(1,4), (2,2),(2,5), (3,3),(4,4);
      INSERT INTO t VALUES (1,1), (1,5),(1,4), (2,2),(2,5), (3,3),(4,4);
      SELECT i,  last_value(count(i)) OVER (partition BY i) FROM t GROUP BY i;
      

      MariaDB [test]> SELECT i,  last_value(count(i)) OVER (partition by i) FROM t GROUP BY i;
      ERROR 1111 (HY000): Invalid use of group function
      

      PostgreSQL:
      i last_value
      1 6
      2 4
      3 2
      4 2

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated: