xitep commented on code in PR #2214:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2214#discussion_r2832516436
##########
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:
i understand having method less in the dialect is desirable. but i fear it
would be too simplistic. the difference between postgres and oracle is that the
former requires the "AS" keyword for the alias, while the latter does not
accept it and will lead to an error. so, while both dialects want to
configurable allow the parsing of "insert table aliases", they both need to
tell the parser in which kind the alias is accepted.
i can offer to introduce an `enum AliasStyle { ExplicitOnly, ImplicitOnly,
Both }` together with a `Dialect::supports_insert_table_alias(&self) ->
Option<AliasStyle>`. nevertheless, it will still leave the control flow in the
parser's "insert table" method rather complicated :/
--
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]