graup opened a new issue, #1695:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/1695

   `impl fmt::Display for EscapeQuotedString` (which is used when formatting a 
Value expr) uses double quote character escaping (like `''` or `""`) which is a 
syntax error in BigQuery. 
   
   This was also reported in PRQL: https://github.com/PRQL/prql/issues/5099
   
   To fix this, I think we need to make this method aware of the dialect. And 
potentially add a new supports rule (like supports_backslash_escaping?)
   
   Here is a failing test case you can add to tests/sqlparser_bigquery.rs 
   
   ```rs
   #[test]
   fn test_quote_escape() {
       bigquery().verified_expr(r#"JSON '{"foo":"bar\'s"}'"#); // Wrong output: 
`JSON '{"foo":"bar''s"}'`
       bigquery().verified_expr(r#"JSON "{\"foo\":\"bar's\"}""#); // Wrong 
output: `JSON "{""foo"":""bar's""}"`
   }
   ```
   
   Both of these are valid BigQuery Syntax. They get parsed into the AST 
correctly but get formatted incorrectly.


-- 
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: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to