sabir-akhadov-localstack commented on code in PR #2745:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2745#discussion_r4414007429


##########
src/parser/mod.rs:
##########
@@ -21304,14 +21330,36 @@ impl<'a> Parser<'a> {
         if !self.parse_keyword(Keyword::OPTIONS) {
             return Ok(None);
         }
+        self.expect_token(&Token::LParen)?;
+        let options = self.parse_comma_separated(Parser::parse_pg_option)?;
+        self.expect_token(&Token::RParen)?;
+        Ok(Some(options))
+    }
+
+    fn parse_pg_option(&mut self) -> Result<CreateServerOption, ParserError> {
+        let key = self.parse_identifier()?;
+        let value = self.parse_identifier()?;
+        Ok(CreateServerOption { key, value })
+    }
+
+    /// Parse the parenthesized list following `OPTIONS` in an `ALTER` 
statement.
+    fn parse_alter_generic_options(&mut self) -> 
Result<Vec<AlterGenericOption>, ParserError> {
         self.expect_token(&Token::LParen)?;
         let options = self.parse_comma_separated(|p| {
-            let key = p.parse_identifier()?;
-            let value = p.parse_identifier()?;
-            Ok(CreateServerOption { key, value })
+            if p.parse_keyword(Keyword::SET) {

Review Comment:
   Non-blocking: PG 16 reads `OPTIONS (add 'x')` / `OPTIONS (set 'x')` / 
`OPTIONS (drop 'x')` as a plain option named `add`/`set`/`drop` (it gets past 
the grammar and fails with `invalid option "add"`), while here the first two 
fail with `Expected: identifier, found: )` and the last becomes `DROP 'x'`. 
Treating `ADD`/`SET`/`DROP` as the action only when the next token is not a 
string literal would match.



-- 
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]

Reply via email to