fmguerreiro commented on code in PR #2515:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2515#discussion_r4099289111
##########
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:
shoot, you're right! fixed in 4207b276
--
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]