You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by gi...@apache.org on 2026/06/06 06:15:43 UTC
(datafusion-sqlparser-rs) 01/01: Microsoft sql server: Escape quotes in national string display (#2365)
This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-2365-d0c081ea2dea327031ad31300cd0791a3b87a667
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git
commit bd8a2c19037c0eca178a45a5f32bde77f07a0cba
Author: Ophir LOJKINE <op...@datadoghq.com>
AuthorDate: Sat Jun 6 08:15:19 2026 +0200
Microsoft sql server: Escape quotes in national string display (#2365)
---
src/ast/value.rs | 2 +-
tests/sqlparser_common.rs | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/ast/value.rs b/src/ast/value.rs
index ade7decf..a906c4b3 100644
--- a/src/ast/value.rs
+++ b/src/ast/value.rs
@@ -273,7 +273,7 @@ impl fmt::Display for Value {
Value::DollarQuotedString(v) => write!(f, "{v}"),
Value::EscapedStringLiteral(v) => write!(f, "E'{}'", escape_escaped_string(v)),
Value::UnicodeStringLiteral(v) => write!(f, "U&'{}'", escape_unicode_string(v)),
- Value::NationalStringLiteral(v) => write!(f, "N'{v}'"),
+ Value::NationalStringLiteral(v) => write!(f, "N'{}'", escape_single_quote_string(v)),
Value::QuoteDelimitedStringLiteral(v) => v.fmt(f),
Value::NationalQuoteDelimitedStringLiteral(v) => write!(f, "N{v}"),
Value::HexStringLiteral(v) => write!(f, "X'{v}'"),
diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
index 62701642..37bba85f 100644
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -6192,6 +6192,10 @@ fn parse_literal_string() {
one_statement_parses_to("SELECT x'deadBEEF'", "SELECT X'deadBEEF'");
one_statement_parses_to("SELECT n'national string'", "SELECT N'national string'");
+ one_statement_parses_to(
+ r#"SELECT n'Tu geres '';'' et ''"'' ?'"#,
+ r#"SELECT N'Tu geres '';'' et ''"'' ?'"#,
+ );
}
#[test]
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org