iffyio commented on code in PR #2214:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2214#discussion_r2832228786
##########
src/parser/mod.rs:
##########
@@ -17166,12 +17166,27 @@ impl<'a> Parser<'a> {
let table = self.parse_keyword(Keyword::TABLE);
let table_object = self.parse_table_object()?;
- let table_alias =
- if dialect_of!(self is PostgreSqlDialect) &&
self.parse_keyword(Keyword::AS) {
- Some(self.parse_identifier()?)
- } else {
- None
- };
+ let table_alias = if
self.dialect.supports_insert_table_implicit_alias()
Review Comment:
thinking the double dialect methods introduced and the logic here could be
simplified with something like:
```rust
let table_alias = if self.dialect.supports_insert_table_alias() &&
!self.peek_sub_query() && self.peek_one_of_keywords(AS, DEFAULT,
VALUES).is_none() {
let explicit = self.parse_keyword(AS);
let alias = self.maybe_parse(parse_identifier); // required if `explicit`
Some(TableAliasWithoutColumns {
explicit: true,
alias: self.parse_identifier()?,
})
} else { None }
```
--
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]