File tree Expand file tree Collapse file tree 4 files changed +19
-4
lines changed Expand file tree Collapse file tree 4 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,9 @@ impl Dialect for MySqlDialect {
51
51
}
52
52
53
53
fn is_identifier_part ( & self , ch : char ) -> bool {
54
- self . is_identifier_start ( ch) || ch. is_ascii_digit ( )
54
+ self . is_identifier_start ( ch) || ch. is_ascii_digit ( ) ||
55
+ // MySQL implements Unicode characters in identifiers.
56
+ !ch. is_ascii ( )
55
57
}
56
58
57
59
fn is_delimited_identifier_start ( & self , ch : char ) -> bool {
Original file line number Diff line number Diff line change @@ -72,7 +72,9 @@ impl Dialect for PostgreSqlDialect {
72
72
}
73
73
74
74
fn is_identifier_part ( & self , ch : char ) -> bool {
75
- ch. is_alphabetic ( ) || ch. is_ascii_digit ( ) || ch == '$' || ch == '_'
75
+ ch. is_alphabetic ( ) || ch. is_ascii_digit ( ) || ch == '$' || ch == '_' ||
76
+ // PostgreSQL implements Unicode characters in identifiers.
77
+ !ch. is_ascii ( )
76
78
}
77
79
78
80
fn supports_unicode_string_literal ( & self ) -> bool {
Original file line number Diff line number Diff line change @@ -86,9 +86,9 @@ impl Dialect for RedshiftSqlDialect {
86
86
}
87
87
88
88
fn is_identifier_part ( & self , ch : char ) -> bool {
89
- // Extends Postgres dialect with sharp and UTF-8 multibyte chars
89
+ // UTF-8 multibyte characters are supported in identifiers via the PostgreSqlDialect.
90
90
// https://docs.aws.amazon.com/redshift/latest/dg/r_names.html
91
- PostgreSqlDialect { } . is_identifier_part ( ch) || ch == '#' || !ch . is_ascii ( )
91
+ PostgreSqlDialect { } . is_identifier_part ( ch) || ch == '#'
92
92
}
93
93
94
94
/// redshift has `CONVERT(type, value)` instead of `CONVERT(value, type)`
Original file line number Diff line number Diff line change @@ -16136,3 +16136,14 @@ SELECT * FROM tbl2
16136
16136
assert_eq!(stmts.len(), 2);
16137
16137
assert!(stmts.iter().all(|s| matches!(s, Statement::Query { .. })));
16138
16138
}
16139
+
16140
+ #[test]
16141
+ fn test_identifier_unicode_support() {
16142
+ let sql = r#"SELECT phoneǤЖשचᎯ⻩☯♜🦄⚛🀄ᚠ⌛🌀 AS tbl FROM customers"#;
16143
+ let dialects = TestedDialects::new(vec![
16144
+ Box::new(MySqlDialect {}),
16145
+ Box::new(RedshiftSqlDialect {}),
16146
+ Box::new(PostgreSqlDialect {}),
16147
+ ]);
16148
+ let _ = dialects.verified_stmt(sql);
16149
+ }
You can’t perform that action at this time.
0 commit comments