LucaCappelletti94 commented on code in PR #2251:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2251#discussion_r3493430882


##########
src/parser/mod.rs:
##########
@@ -5238,6 +5238,12 @@ impl<'a> Parser<'a> {
             self.parse_create_snapshot_table().map(Into::into)
         } else if self.peek_keywords(&[Keyword::TEXT, Keyword::SEARCH]) {
             self.parse_create_text_search().map(Into::into)
+        } else if self.peek_keywords(&[Keyword::UNLOGGED, Keyword::TABLE]) {
+            self.expect_keywords(&[Keyword::UNLOGGED, Keyword::TABLE])?;
+            let mut create_table = self
+                .parse_create_table(or_replace, temporary, global, transient, 
volatile, multiset)?;

Review Comment:
   Ok now `unlogged` is flagged up front and reuses the single 
`parse_create_table` call.
   
   I kept a `peek_keywords([UNLOGGED, TABLE])` guard instead of an 
unconditional `parse_keyword` like `volatile`. Unconditional consume means 
every other `CREATE` branch swallows a stray `UNLOGGED` and drops it:
   
   ```
   CREATE UNLOGGED VIEW v AS SELECT 1   => CREATE VIEW v AS SELECT 1
   CREATE UNLOGGED INDEX idx ON t (a)   => CREATE INDEX idx ON t(a)
   CREATE UNLOGGED DATABASE d           => CREATE DATABASE d
   CREATE UNLOGGED SEQUENCE seq         => CREATE SEQUENCE seq   -- valid PG, 
modifier silently lost
   ```
   
   The peek keeps these erroring via the existing final `else`.



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