iffyio commented on code in PR #1576:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/1576#discussion_r1874372151
##########
tests/sqlparser_redshift.rs:
##########
@@ -353,3 +380,23 @@ fn test_parse_json_path_from() {
_ => panic!(),
}
}
+
+#[test]
+fn test_parse_select_numbered_columns() {
+ // An alias starting with a number
+ redshift_and_generic().verified_stmt(r#"SELECT 1 AS "1" FROM a"#);
+ redshift_and_generic().verified_stmt(r#"SELECT 1 AS "1abc" FROM a"#);
+}
+
+#[test]
+fn test_parse_nested_quoted_identifier() {
+ redshift().verified_stmt(r#"SELECT 1 AS ["1"] FROM a"#);
+ redshift().verified_stmt(r#"SELECT 1 AS [ " 1 " ]"#);
Review Comment:
Oh yeah I think that the linked test would be incorrect as well? from what I
could tell and tested the following seemed to all be equivalent in redshift
```sql
SELECT 1 AS foo;
SELECT 1 AS [ foo ];
SELECT 1 AS [ "foo" ];
```
so that whitespace within the brackets isn't part of the identifier. Then it
would be incorrect to have an identifier in the AST that contains the string `
foo ` for any of the above.
On the other hand this would actually be referencing an identifier
containing whitespace
```sql
SELECT 1 AS [" foo "];
```
--
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]