Added support for unpivot in Redshift with expression and bracketsless#2375
Open
kfirSatori wants to merge 2 commits into
Open
Added support for unpivot in Redshift with expression and bracketsless#2375kfirSatori wants to merge 2 commits into
kfirSatori wants to merge 2 commits into
Conversation
Author
|
@iffyio Can you help me with the PR, it's a while here. |
iffyio
reviewed
Jul 14, 2026
| /// Syntax: | ||
| /// ```sql | ||
| /// UNPIVOT expression AS value_alias [AT attribute_alias] | ||
| /// ``` |
Contributor
There was a problem hiding this comment.
Can we add a link to the docs describing the syntax?
| /// ```sql | ||
| /// UNPIVOT expression AS value_alias [AT attribute_alias] | ||
| /// ``` | ||
| fn supports_unpivot_expr_in_from(&self) -> bool { |
Contributor
There was a problem hiding this comment.
Suggested change
| fn supports_unpivot_expr_in_from(&self) -> bool { | |
| fn supports_unpivot_expr(&self) -> bool { |
Comment on lines
+547
to
+561
| fn parse_unpivot_expression() { | ||
| let sql = r#"SELECT t.id, k, v FROM test_colors as t, UNPIVOT t.count_by_color AS v AT k; | ||
| "#; | ||
|
|
||
| redshift().parse_sql_statements(sql).unwrap(); | ||
|
|
||
| } | ||
|
|
||
| #[test] | ||
| fn parse_unpivot_no_brackets() { | ||
| let sql = r#"SELECT t.id, k, v FROM test_colors as t, UNPIVOT t AS v AT k; | ||
| "#; | ||
|
|
||
| redshift().parse_sql_statements(sql).unwrap(); | ||
|
|
Contributor
There was a problem hiding this comment.
let's use verified_stmt also we can merge the test cases into the same function
| with_ordinality, | ||
| }) | ||
| } else if self.dialect.supports_unpivot_expr_in_from() | ||
| && self.parse_keyword(Keyword::UNPIVOT) |
Contributor
There was a problem hiding this comment.
can we change this to self.peek(UNPIVOT) so that the parse_unpivot_expr_table_factor is standalone since we're making it a public function?
| true | ||
| } | ||
|
|
||
| fn supports_unpivot_expr_in_from(&self) -> bool { |
Contributor
There was a problem hiding this comment.
can we add a link to the redshift docs?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added support for unpivot in Redshift with expression and bracketsless:
SELECT t.id, k, v FROM test_colors as t, UNPIVOT t.count_by_color AS v AT k;