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

LAG function doesn't require ORDER BY in OVER clause

    XMLWordPrintable

Details

    Description

      Our current implementation selects an ordering for rows implicitly. This can lead to results that look like this:

      create table t1 (a int);
      insert into t1 values (1), (2), (10), (0);
      select a, lag(a, 1) over () from t1;
      a    lag(a, 1) over ()
      1    0
      2    1
      10    2
      0    NULL
      

      The ordering used by lag is (ORDER BY a), but we don't return the rows in this order. Also, this would be quite confusing if multiple window functions are used.

      Instead of running this query like this and produce confusing results, we should return an error of the form:

      "No order list in window specification for 'LAG'"
      

      Attachments

        Activity

          People

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