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

Syntax Error when selecting from a view with compound window function

    XMLWordPrintable

Details

    Description

      The following query works:

      select a + min(a) over (partition by a) from t1 where a = 1;
       
      a + min(a) over (partition by a)
      2
      2
      2
      

      However this one fails with a strange parser error:

      create view win_view
      as (select a, a + min(a) over (partition by a) from t1 where a = 1);
      select * from win_view;
      

      query 'select * from win_view' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '???) AS `a + min(a) over (partition by a)` from `test`.`t1` where (`test`.`t1`.`' at line 1
      

      Note that the following views however work:

      create view some_view
      as (select a, a + a from t1 where a = 1);
      select * from some_view;
      a	a + a
      1	2
      1	2
      1	2
      create view win_view
      as (select a, min(a) over (partition by a) from t1 where a = 1);
      select * from win_view;
      a	min(a) over (partition by a)
      1	1
      1	1
      1	1
      

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            cvicentiu Vicențiu Ciorbaru
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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