sql-parser icon indicating copy to clipboard operation
sql-parser copied to clipboard

Support for window functions like RANK

Open stevenwdv opened this issue 6 years ago • 0 comments

The validator marks queries with an alias (with or without AS) after window functions like RANK, DENSE_RANK, ROW_NUMBER, CUME_DIST, etc. as incorrect: SELECT RANK() OVER(ORDER BY NULL) rank

[
  {
    "message": "An alias was previously found. (near <code>rank</code>)",
    "fromLine": 0,
    "fromColumn": 34,
    "toLine": 0,
    "toColumn": 38,
    "severity": "error"
  },
  {
    "message": "Unexpected token. (near <code>rank</code>)",
    "fromLine": 0,
    "fromColumn": 34,
    "toLine": 0,
    "toColumn": 38,
    "severity": "error"
  }
]

Support for this type of functions is probably not present yet, but weirdly enough the validator doesn't complain for queries without alias.

PHPMyAdmin 4.7.9 MariaDB 10.3.1 (window functions are supported since 10.2.0)

Update: these will also be supported in MySQL 8.0

stevenwdv avatar Mar 09 '18 14:03 stevenwdv