LucaCappelletti94 opened a new pull request, #2675: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2675
PostgreSQL makes both the target list and the `FROM` clause optional (https://www.postgresql.org/docs/current/sql-select.html), so a bare `SELECT`, `SELECT WHERE true`, `SELECT UNION SELECT` or `(SELECT)` are valid, and PostgreSQL 16 runs all of them. The parser only took an empty target list when `FROM` came next, so these failed with `Expected: an expression, found: EOF`. For dialects with `supports_empty_projections`, the target list is now empty whenever the next token cannot start one: end of input, `;`, `)`, or `INTO`, `FROM`, `WHERE`, `GROUP`, `HAVING`, `WINDOW`, `ORDER`, `LIMIT`, `OFFSET`, `FETCH`, `FOR`, `UNION`, `INTERSECT` or `EXCEPT`. Only PostgreSQL and the generic dialect set the capability, and DuckDB 1.4.4 rejects even `SELECT FROM t`, so no other dialect changes. Tests cover each of these forms, a missing `WHERE` expression, and the unchanged error in dialects without the capability. -- 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]
