mvzink commented on code in PR #1752: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1752#discussion_r1975779815
########## src/parser/mod.rs: ########## @@ -10962,15 +10962,17 @@ impl<'a> Parser<'a> { OneOrManyWithParens::One(self.parse_object_name(false)?) }; - if matches!(&variables, OneOrManyWithParens::One(variable) if variable.to_string().eq_ignore_ascii_case("NAMES") - && dialect_of!(self is MySqlDialect | GenericDialect)) - { + let names = matches!(&variables, OneOrManyWithParens::One(variable) if variable.to_string().eq_ignore_ascii_case("NAMES")); + + if names && self.dialect.supports_set_names() { if self.parse_keyword(Keyword::DEFAULT) { return Ok(Statement::SetNamesDefault {}); } - let charset_name = self.parse_literal_string()?; - let collation_name = if self.parse_one_of_keywords(&[Keyword::COLLATE]).is_some() { + let charset_name = self.parse_identifier()?; + let collation_name = if self.dialect.supports_set_names_collation() Review Comment: The only reason to add the flag was to fail parsing in Postgres; but you're right that it doesn't introduce ambiguity, so it would probably be fine to be more permissive. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org