This is an automated email from the ASF dual-hosted git repository.
iffyio pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git
The following commit(s) were added to refs/heads/main by this push:
new d5dbe86d re-add support for nested comments in mssql (#1754)
d5dbe86d is described below
commit d5dbe86da9c0591d5c2bf573b641d539f04e3028
Author: Ophir LOJKINE <[email protected]>
AuthorDate: Sat Mar 1 07:13:33 2025 +0100
re-add support for nested comments in mssql (#1754)
---
src/dialect/mssql.rs | 5 +++++
tests/sqlparser_mssql.rs | 16 ++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/src/dialect/mssql.rs b/src/dialect/mssql.rs
index 980f5ec3..aeed1eb7 100644
--- a/src/dialect/mssql.rs
+++ b/src/dialect/mssql.rs
@@ -95,4 +95,9 @@ impl Dialect for MsSqlDialect {
fn supports_timestamp_versioning(&self) -> bool {
true
}
+
+ /// See
<https://learn.microsoft.com/en-us/sql/t-sql/language-elements/slash-star-comment-transact-sql?view=sql-server-ver16>
+ fn supports_nested_comments(&self) -> bool {
+ true
+ }
}
diff --git a/tests/sqlparser_mssql.rs b/tests/sqlparser_mssql.rs
index ec565e50..3f313af4 100644
--- a/tests/sqlparser_mssql.rs
+++ b/tests/sqlparser_mssql.rs
@@ -1620,6 +1620,22 @@ fn parse_create_table_with_valid_options() {
}
}
+#[test]
+fn parse_nested_slash_star_comment() {
+ let sql = r#"
+ select
+ /*
+ comment level 1
+ /*
+ comment level 2
+ */
+ */
+ 1;
+ "#;
+ let canonical = "SELECT 1";
+ ms().one_statement_parses_to(sql, canonical);
+}
+
#[test]
fn parse_create_table_with_invalid_options() {
let invalid_cases = vec![
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]