Skip to content

Commit 7d25859

Browse files
author
Roman Borschel
committed
Enable Redshift support for specifying null treatment outside window function.
Though not explicitly mentioned in the official docs, it is valid SQL for Redshift.
1 parent 913cf0e commit 7d25859

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/dialect/redshift.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,8 @@ impl Dialect for RedshiftSqlDialect {
156156
fn supports_string_literal_concatenation_with_newline(&self) -> bool {
157157
true
158158
}
159+
160+
fn supports_window_function_null_treatment_arg(&self) -> bool {
161+
true
162+
}
159163
}

tests/sqlparser_redshift.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,3 +511,9 @@ fn test_create_table_backup() {
511511
"CREATE TABLE public.users_backup_test BACKUP YES DISTSTYLE AUTO AS SELECT id, name, email FROM public.users",
512512
);
513513
}
514+
515+
#[test]
516+
fn test_null_treatment_inside_and_outside_window_function() {
517+
redshift().verified_stmt("SELECT FIRST_VALUE(1 IGNORE NULLS) OVER () FROM (SELECT 1) t");
518+
redshift().verified_stmt("SELECT FIRST_VALUE(1) IGNORE NULLS OVER () FROM (SELECT 1) t");
519+
}

0 commit comments

Comments
 (0)