diff --git a/fuzz/fuzz_seeds/redshift_2959_nested_comment.sql b/fuzz/fuzz_seeds/redshift_2959_nested_comment.sql new file mode 100644 index 0000000000..5d212eeb63 --- /dev/null +++ b/fuzz/fuzz_seeds/redshift_2959_nested_comment.sql @@ -0,0 +1 @@ +select 1 /* /* */ , ' */ , pg_backend_pid() -- ' diff --git a/src/dialect/redshift.rs b/src/dialect/redshift.rs index e20867cf4b..468a735a77 100644 --- a/src/dialect/redshift.rs +++ b/src/dialect/redshift.rs @@ -191,6 +191,11 @@ impl Dialect for RedshiftSqlDialect { true } + /// See + 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 { diff --git a/tests/sqlparser_redshift.rs b/tests/sqlparser_redshift.rs index 3ffc567e6d..b8e05f1274 100644 --- a/tests/sqlparser_redshift.rs +++ b/tests/sqlparser_redshift.rs @@ -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()", + ); +}