Skip to content

Commit 5949a5d

Browse files
author
Roman Borschel
committed
Allow literal backslash escape in Redshift dialect.
Redshift supports the literal backslash escape at least for a subset of characters, including single quotes ('). This is unfortunately not publicly documented (yet) but used in successful queries.
1 parent 0d2976d commit 5949a5d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/dialect/redshift.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,8 @@ impl Dialect for RedshiftSqlDialect {
125125
fn allow_extract_single_quotes(&self) -> bool {
126126
true
127127
}
128+
129+
fn supports_string_literal_backslash_escape(&self) -> bool {
130+
true
131+
}
128132
}

tests/sqlparser_redshift.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,3 +397,8 @@ fn parse_extract_single_quotes() {
397397
let sql = "SELECT EXTRACT('month' FROM my_timestamp) FROM my_table";
398398
redshift().verified_stmt(sql);
399399
}
400+
401+
#[test]
402+
fn parse_string_literal_backslash_escape() {
403+
redshift().one_statement_parses_to(r#"SELECT 'l\'auto'"#, "SELECT 'l''auto'");
404+
}

0 commit comments

Comments
 (0)