mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-22 15:04:04 +00:00
Redshift - Add support in sharp as start of the field name (#485)
* Add support in sharp * CR Review
This commit is contained in:
parent
ed86c6d53d
commit
35f5f0be4d
2 changed files with 14 additions and 2 deletions
|
@ -44,10 +44,12 @@ impl Dialect for RedshiftSqlDialect {
|
|||
}
|
||||
|
||||
fn is_identifier_start(&self, ch: char) -> bool {
|
||||
PostgreSqlDialect {}.is_identifier_start(ch)
|
||||
// Extends Postgres dialect with sharp
|
||||
PostgreSqlDialect {}.is_identifier_start(ch) || ch == '#'
|
||||
}
|
||||
|
||||
fn is_identifier_part(&self, ch: char) -> bool {
|
||||
PostgreSqlDialect {}.is_identifier_part(ch)
|
||||
// Extends Postgres dialect with sharp
|
||||
PostgreSqlDialect {}.is_identifier_part(ch) || ch == '#'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,3 +100,13 @@ fn redshift() -> TestedDialects {
|
|||
dialects: vec![Box::new(RedshiftSqlDialect {})],
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sharp() {
|
||||
let sql = "SELECT #_of_values";
|
||||
let select = redshift().verified_only_select(sql);
|
||||
assert_eq!(
|
||||
SelectItem::UnnamedExpr(Expr::Identifier(Ident::new("#_of_values"))),
|
||||
select.projection[0]
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue