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 {
5151 }
5252
5353 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 ( )
5557 }
5658
5759 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 {
7272 }
7373
7474 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 ( )
7678 }
7779
7880 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 {
8686 }
8787
8888 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.
9090 // 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 == '#'
9292 }
9393
9494 /// redshift has `CONVERT(type, value)` instead of `CONVERT(value, type)`
Original file line number Diff line number Diff line change @@ -16162,3 +16162,14 @@ SELECT * FROM tbl2
1616216162 assert_eq!(stmts.len(), 2);
1616316163 assert!(stmts.iter().all(|s| matches!(s, Statement::Query { .. })));
1616416164}
16165+
16166+ #[test]
16167+ fn test_identifier_unicode_support() {
16168+ let sql = r#"SELECT phoneǤЖשचᎯ⻩☯♜🦄⚛🀄ᚠ⌛🌀 AS tbl FROM customers"#;
16169+ let dialects = TestedDialects::new(vec![
16170+ Box::new(MySqlDialect {}),
16171+ Box::new(RedshiftSqlDialect {}),
16172+ Box::new(PostgreSqlDialect {}),
16173+ ]);
16174+ let _ = dialects.verified_stmt(sql);
16175+ }
You can’t perform that action at this time.
0 commit comments