Skip to content

Redshift dialect: support nested block comments #2959

Open

Description

@preston-footprint

Redshift nests /* */ comments, as Postgres does, but RedshiftSqlDialect doesn't set supports_nested_comments, so sqlparser ends the comment at the first */.

select 1 /* /* */ , ' */ , pg_backend_pid() -- '
  • sqlparser 0.64.0: MultiLineComment(" /* "), then a string; parses as SELECT 1, ' */ , pg_backend_pid() -- '.
  • Redshift: two columns, 1 and 1073905994, so the comment ran to the second */.

The overlapping form select 1 /*/*/ , ' */ */ , pg_backend_pid() -- ' behaves the same way on both sides.

Postgres documents nesting in "Comments" (https://www.postgresql.org/docs/8.0/sql-syntax.html#SQL-SYNTAX-COMMENTS), and Redshift is based on PostgreSQL 8.0.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions