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

Error with aggregate function inside of last_value() window function

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

            varun Varun Gupta (Inactive) added a comment - Patch http://lists.askmonty.org/pipermail/commits/2020-June/014271.html

            This is a followup fix to MDEV-11867

            varun Varun Gupta (Inactive) added a comment - This is a followup fix to MDEV-11867

            igor looked at the patch and replied that he thinks that the patch does not look safe. So i need to investigate this further.

            varun Varun Gupta (Inactive) added a comment - igor looked at the patch and replied that he thinks that the patch does not look safe. So i need to investigate this further.

            People

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

              Dates

                Created:
                Updated:

                Git Integration

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