iffyio commented on code in PR #2469:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2469#discussion_r3946615141


##########
src/parser/mod.rs:
##########
@@ -20167,15 +20167,34 @@ impl<'a> Parser<'a> {
     }
 
     fn parse_pragma_value(&mut self) -> Result<ValueWithSpan, ParserError> {
-        let v = self.parse_value()?;
+        let span = self.peek_token_ref().span;
+        let v = match self.parse_one_of_keywords(&[
+            Keyword::TRUE,
+            Keyword::FALSE,
+            Keyword::ON,
+            Keyword::OFF,
+            Keyword::YES,
+            Keyword::NO,
+        ]) {
+            Some(keyword) => Value::Boolean(matches!(
+                keyword,
+                Keyword::TRUE | Keyword::YES | Keyword::ON
+            ))
+            .with_span(span),
+            None => self.parse_value()?,
+        };
         match &v.value {
             Value::SingleQuotedString(_) => Ok(v),
             Value::DoubleQuotedString(_) => Ok(v),
             Value::Number(_, _) => Ok(v),
+            Value::Boolean(_) => Ok(v),
             Value::Placeholder(_) => Ok(v),
             _ => {
                 self.prev_token();
-                self.expected_ref("number or string or ? placeholder", 
self.peek_token_ref())
+                self.expected_ref(
+                    "boolean, number, string, or ? placeholder",
+                    self.peek_token_ref(),
+                )

Review Comment:
   I think we could simplify the logic to have it accept whatever parse_value 
returns. and keep the sqlite semantics for validation upstream? that would have 
avoided this bug in the initial version



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