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

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              alice Alice Sherepa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 4.5h
                  4.5h

                  Git Integration

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