Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
7phs committed Dec 3, 2024
1 parent 5e55dfe commit 9d5d71b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/dialect/redshift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ impl Dialect for RedshiftSqlDialect {
/// treating them as json path. If there is identifier then we assume
/// there is no json path.
fn is_proper_identifier_inside_quotes(&self, mut chars: Peekable<Chars<'_>>) -> bool {
// PartiQL (used as json path query language in Redshift) uses square bracket as a start character and a quote is a beginning of quoted identifier
// PartiQL (used as json path query language in Redshift) uses square bracket as
// a start character and a quote is a beginning of quoted identifier.
// Skipping analyzing token such as `"a"` and analyze only token that
// can be part of json path potentially.
// For ex., `[0]`, `['a']` (seems part of json path) or `["a"]` (normal quoted identifier)
if let Some(quote_start) = chars.peek() {
if *quote_start == '"' {
return true;
Expand All @@ -52,7 +56,8 @@ impl Dialect for RedshiftSqlDialect {
if let Some(&ch) = not_white_chars.peek() {
// PartiQL uses single quote as starting identification inside a quote
// It is a normal identifier if it has no single quote at the beginning.
// Additionally square bracket can contain quoted identifier.
// Square bracket can contain quoted identifier.
// For ex., `["a"]`, but this is not a part of json path, and it is a normal quoted identifier.
return ch == '"' || self.is_identifier_start(ch);
}
false
Expand Down

0 comments on commit 9d5d71b

Please sign in to comment.