adriangb opened a new pull request, #2651:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2651
`WITH c AS [NOT] MATERIALIZED (...)` parses only with `PostgreSqlDialect`,
because the parser uses a hard-coded dialect check. DuckDB also accepts this
syntax, and custom dialects cannot opt in to it.
```rust
let sql = "WITH c AS MATERIALIZED (SELECT 1) SELECT * FROM c";
Parser::parse_sql(&DuckDbDialect {}, sql) // Err: Expected: (, found:
MATERIALIZED
```
This PR replaces the check with a `Dialect::supports_cte_materialization`
method that is off by default. The method returns `true` for PostgreSQL and
DuckDB. `GenericDialect` still rejects the syntax. Tests check the AST value,
the SQL round trip, and the rejection by every dialect that does not opt in.
--
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]