LucaCappelletti94 opened a new pull request, #2672:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2672

   A window specification may start with the name of a window defined in the 
`WINDOW` clause, as in `OVER (w ORDER BY a)`.
   
   PostgreSQL calls it `existing_window_name` 
(https://www.postgresql.org/docs/current/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS),
 SQLite calls it the base window 
(https://www.sqlite.org/windowfunctions.html#wchaining), and MySQL documents 
the same reuse 
(https://dev.mysql.com/doc/refman/8.4/en/window-functions-named-windows.html). 
The parser only took a base window name when the word was not in this crate's 
keyword list, so `OVER (id ORDER BY a)` or `OVER (part ORDER BY a)` failed in 
every dialect, although SQLite 3.51.1, DuckDB 1.4.4 and PostgreSQL 16 all run 
`SELECT count(*) OVER (id ORDER BY a) FROM t WINDOW id AS (PARTITION BY a)`.
   
   The base window name is now any word other than the keywords that can start 
the rest of the specification: `PARTITION`, `ORDER`, `ROWS`, `RANGE` and 
`GROUPS`. A test checks the parsed name for `w`, `id` and `part` in every 
dialect, and that specifications starting with those keywords still parse as 
before.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to