Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fuzz/fuzz_seeds/redshift_2959_nested_comment.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select 1 /* /* */ , ' */ , pg_backend_pid() -- '
5 changes: 5 additions & 0 deletions src/dialect/redshift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ impl Dialect for RedshiftSqlDialect {
true
}

/// See <https://www.postgresql.org/docs/8.0/sql-syntax.html#SQL-SYNTAX-COMMENTS>
fn supports_nested_comments(&self) -> bool {
true
}

/// `INTERVAL` is listed as reserved in Redshift docs but the actual parser allows it as an
/// identifier, consistent with pgsql.
fn is_reserved_for_identifier(&self, kw: Keyword) -> bool {
Expand Down
12 changes: 12 additions & 0 deletions tests/sqlparser_redshift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,3 +518,15 @@ fn parse_approximate_percentile_disc() {
"SELECT APPROXIMATE AS PERCENTILE_DISC FROM t",
);
}

#[test]
fn parse_nested_block_comment() {
redshift().one_statement_parses_to(
"SELECT 1 /* /* */ , ' */ , pg_backend_pid() -- '",
"SELECT 1, pg_backend_pid()",
);
redshift().one_statement_parses_to(
"SELECT 1 /*/*/ , ' */ */ , pg_backend_pid() -- '",
"SELECT 1, pg_backend_pid()",
);
}
Loading