sabir-akhadov-localstack commented on code in PR #2593:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2593#discussion_r4423364150


##########
src/ast/value.rs:
##########
@@ -605,7 +607,21 @@ impl fmt::Display for EscapeQuotedString<'_> {
 /// Return a helper which formats `string` for inclusion inside a quoted
 /// literal that uses `quote` as the delimiter.
 pub fn escape_quoted_string(string: &str, quote: char) -> 
EscapeQuotedString<'_> {
-    EscapeQuotedString { string, quote }
+    EscapeQuotedString {
+        string,
+        quote,
+        backslash_escape: true,
+    }
+}
+
+/// Like [`escape_quoted_string`], for quoted identifiers, which the tokenizer
+/// never backslash-escapes.
+pub(crate) fn escape_quoted_identifier(string: &str, quote: char) -> 
EscapeQuotedString<'_> {

Review Comment:
   Same reasoning applies to the "already doubled" skip: the tokenizer folds 
`""` in identifiers too, so `SELECT "a"""""` (value `a""`) still prints as 
`"a"""` and reparses as `a"`. Identifiers could double every quote 
unconditionally. Pre-existing, fine as a follow-up.



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