Skip to content

Add support for Redshift SELECT * EXCLUDE#1936

Merged
iffyio merged 2 commits intoapache:mainfrom
yoavcloud:redshift_select_exclude
Jul 11, 2025
Merged

Add support for Redshift SELECT * EXCLUDE#1936
iffyio merged 2 commits intoapache:mainfrom
yoavcloud:redshift_select_exclude

Conversation

@yoavcloud
Copy link
Copy Markdown
Contributor

Redshift supports placing the EXCLUDE option at the end of the projection list, not necessarily after the wildcard. For example: SELECT *, c1 EXCLUDE c2 FROM test (exclude column c2 from the list of all columns including c1).

Added support for parsing this option by reusing the existing ExcludeSelectItem struct but placing it at the query level, after the projection.

Comment thread tests/sqlparser_common.rs
_ => unreachable!(),
}

let dialects = all_dialects_where(|d| d.supports_select_exclude());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a test with

let dialects = all_dialects_where(|d| d.supports_select_wildcard_exclude() && !d.supports_select_exclude());

like in snowflake's case to demonstrate the behavior when there is e.g. an exclude that is an ident SELECT *, EXCLUDE c1 FROM test or similar

@yoavcloud yoavcloud force-pushed the redshift_select_exclude branch from 9da1b35 to 85a8ea4 Compare July 11, 2025 07:31
Copy link
Copy Markdown
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @yoavcloud!
cc @alamb

@iffyio iffyio changed the title Add support for Redshift SELECT * EXCLUDE Add support for Redshift SELECT * EXCLUDE Jul 11, 2025
@iffyio iffyio merged commit ee31b64 into apache:main Jul 11, 2025
10 checks passed
ayman-sigma pushed a commit to sigmacomputing/sqlparser-rs that referenced this pull request Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants