LucaCappelletti94 opened a new pull request, #2780: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2780
`SELECT t.*::t AS t FROM t` fails under `PostgreSqlDialect` with `Expected: end of statement, found: ::`, and so do `UPDATE t SET a = 1 RETURNING t.*::t` and `SELECT f(t.*::t) FROM t`. PostgreSQL accepts all three, and `pg_get_functiondef`, `pg_get_viewdef` and `pg_dump` print a whole-row reference at the top of a target list in exactly this form, because the cast stops `t.*` from being expanded into its columns ([ruleutils.c, `get_variable`](https://github.com/postgres/postgres/blob/REL_18_STABLE/src/backend/utils/adt/ruleutils.c#L7600-L7618)). `Parser::parse_wildcard_expr` returned the qualified wildcard as soon as it read `t.*`, before looking at what follows. When `::` comes next it now parses the item as an expression, where `t.*` is already an operand under PostgreSQL (`WHERE t.* IS NOT NULL` parses today), so the item becomes a `Cast` of `Expr::QualifiedWildcard`. A plain `t.*` keeps its wildcard select item. Very small change, very long explaination. -- 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]
