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


##########
src/ast/spans.rs:
##########
@@ -3163,4 +3164,19 @@ WHERE id = 1
             Span::new(Location::new(2, 8), Location::new(4, 52))
         );
     }
+
+    #[test]
+    fn test_create_foreign_table_span_includes_option_keys() {
+        let dialect = &crate::dialect::PostgreSqlDialect {};
+        let sql = "CREATE FOREIGN TABLE ft (a INT) SERVER s OPTIONS 
(schema_name 'public')";
+        let mut test = SpanTest::new(dialect, sql);
+
+        // Ends at the option key, not the statement: a quoted option value is 
an
+        // Ident with an empty span, so it contributes nothing to the union.
+        let stmt = test.0.parse_statement().unwrap();
+        assert_eq!(
+            test.get_source(stmt.span()),
+            "ft (a INT) SERVER s OPTIONS (schema_name"
+        );
+    }

Review Comment:
   You should not pin known-wrong behaviour in tests. This span stops at 
`(schema_name` because `parse_identifier` gives quoted identifiers an empty 
span.
   
   ```suggestion
   ```



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