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/09/22 20:12:02 UTC
(datafusion-sqlparser-rs) branch gh-readonly-queue/main/pr-2542-d3983044c09f340965e4b904015914bd09fbbefe created (now 80751ede1)
This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a change to branch gh-readonly-queue/main/pr-2542-d3983044c09f340965e4b904015914bd09fbbefe
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git
at 80751ede1 Generic: Fix quote escaping when displaying hex string literals (#2542)
This branch includes the following new commits:
new 80751ede1 Generic: Fix quote escaping when displaying hex string literals (#2542)
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org
(datafusion-sqlparser-rs) 01/01: Generic: Fix quote escaping when displaying hex string literals (#2542)
Posted by gi...@apache.org.
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-2542-d3983044c09f340965e4b904015914bd09fbbefe
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git
commit 80751ede152ef3afeabca910562db559d5459e7e
Author: Luca Cappelletti <ca...@gmail.com>
AuthorDate: Tue Sep 22 20:11:41 2026 +0000
Generic: Fix quote escaping when displaying hex string literals (#2542)
---
src/ast/value.rs | 14 +++++++++++++-
tests/sqlparser_common.rs | 7 +++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/ast/value.rs b/src/ast/value.rs
index a906c4b3f..ad5dd1ab6 100644
--- a/src/ast/value.rs
+++ b/src/ast/value.rs
@@ -276,7 +276,7 @@ impl fmt::Display for Value {
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}'"),
+ Value::HexStringLiteral(v) => write!(f, "X'{}'", escape_single_quote_string(v)),
Value::Boolean(v) => write!(f, "{v}"),
Value::SingleQuotedByteStringLiteral(v) => write!(f, "B'{v}'"),
Value::DoubleQuotedByteStringLiteral(v) => write!(f, "B\"{v}\""),
@@ -717,3 +717,15 @@ fn test_escape_quoted_string_with_multibyte_quote_char() {
"a🦀🦀b🦀🦀c"
);
}
+#[cfg(test)]
+#[test]
+fn test_hex_string_literal_display_escaping() {
+ assert_eq!(
+ Value::HexStringLiteral("'".to_string()).to_string(),
+ "X''''"
+ );
+ assert_eq!(
+ Value::HexStringLiteral("it's".to_string()).to_string(),
+ "X'it''s'"
+ );
+}
diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
index 4343e652b..722cc1419 100644
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -20121,3 +20121,10 @@ fn parse_table_preserves_quotes_and_trailing_tokens() {
err
);
}
+
+#[test]
+fn parse_hex_string_literal_display_escaping() {
+ all_dialects().verified_stmt("SELECT X''''");
+ all_dialects().verified_stmt("SELECT X'ab''cd'");
+ all_dialects().one_statement_parses_to("SELECT x'''' N", "SELECT X'''' AS N");
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org