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

Window function aliases override table columns in OVER (ORDER BY)

    XMLWordPrintable

Details

    Description

      The following examples works in PostGRES but fails in MariaDB:

      create table t1 (pk varchar(10), a int);
       
      insert into t1 values ('a', 1);
      insert into t1 values ('b', 2);
      insert into t1 values ('c', 3);
      insert into t1 values ('d', 4);
       
      select row_number() over (order by pk) pk, a from t1;
      

      The select statement fails with:

      Window function is not allowed in window specification
      

      While this runs perfectly in PostGRES.

      test=# select row_number() over (order by pk) pk, pk, a from test;
       pk | pk | a
      ----+----+---
        1 | a  | 1
        2 | b  | 2
      

      Attachments

        Activity

          People

            cvicentiu Vicențiu Ciorbaru
            cvicentiu Vicențiu Ciorbaru
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.