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

Shift/reduce conflict in window_spec clause: OVER (rows ...)

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.2(EOL)
    • 10.2.4
    • Parser

    Description

      The window_spec clause in sql_yacc.yy has a shift/reduce conflict.

      In a query like this:

      SELECT .. COUNT(*) OVER (rows ...);
      

      It's not clear what rows stands for. It can be ident in opt_window_ref:

      SELECT ... COUNT(*) OVER (rows ORDER BY ...);
      

      or the ROWS keyword in window_frame_units:

      SELECT ... COUNT(*) OVER (ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING);
      

      The conflict happens because ROWS is a non-reserved keyword in MariaDB.

      Possible solutions:

      • Make ROWS a reserved keyword, as in the SQL standard
      • Or change the ident part in opt_window_ref to a new rule ident_window_ref which will not include ROWS.

      Attachments

        Issue Links

          Activity

            People

              igor Igor Babaev
              bar Alexander Barkov
              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.