7phs commented on code in PR #1576:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/1576#discussion_r1868012113
##########
src/dialect/redshift.rs:
##########
@@ -41,10 +41,19 @@ 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
+ if let Some(quote_start) = chars.peek() {
+ if *quote_start == '"' {
+ return true;
+ }
+ };
chars.next();
let mut not_white_chars = chars.skip_while(|ch|
ch.is_whitespace()).peekable();
if let Some(&ch) = not_white_chars.peek() {
- return self.is_identifier_start(ch);
+ // 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.
+ return ch == '"' || ch != '\'' && self.is_identifier_start(ch);
Review Comment:
I added comments with examples to make a reason of conditions little bit
more explicit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]