Skip to content

Redshift: support wildcard select items with alias#2230

Merged
yoavcloud merged 2 commits intoapache:mainfrom
yoabot-droid:fix/redshift-wildcard-alias
Feb 26, 2026
Merged

Redshift: support wildcard select items with alias#2230
yoavcloud merged 2 commits intoapache:mainfrom
yoabot-droid:fix/redshift-wildcard-alias

Conversation

@yoabot-droid
Copy link
Contributor

Problem

Redshift supports aliasing wildcard expressions in SELECT statements:

SELECT t.* AS alias FROM t

Previously the parser would fail with:

ParserError("Expected: end of statement, found: AS")

Confirmed working on a live Redshift database.

Solution

  • Added opt_alias: Option<Ident> field to WildcardAdditionalOptions
  • Added supports_select_wildcard_with_alias() method to the Dialect trait (default: false)
  • Enabled it in RedshiftSqlDialect
  • Parser now consumes AS <alias> when the dialect supports it
  • Updated Display and span tracking for the new field

Tests

Added regression tests in tests/sqlparser_common.rs using all_dialects_where(|d| d.supports_select_wildcard_with_alias()):

  • Qualified wildcard with alias: SELECT t.* AS all_cols FROM t
  • Unqualified wildcard with alias: SELECT * AS all_cols FROM t
  • Mixed multi-join query with regular column + qualified wildcard alias

…alias)

Redshift allows aliasing wildcard expressions in SELECT, e.g.:
  SELECT t.* AS alias FROM t

Previously the parser would fail with:
  ParserError("Expected: end of statement, found: AS")

Fix: add opt_alias field to WildcardAdditionalOptions and parse the
optional AS <alias> clause when the dialect supports it.

Adds supports_select_wildcard_with_alias() dialect method, enabled for
RedshiftSqlDialect.
Use all_dialects_where(|d| d.supports_select_wildcard_with_alias())
so tests apply to any dialect that enables the feature, per project
conventions.
@yoavcloud yoavcloud added this pull request to the merge queue Feb 26, 2026
Merged via the queue into apache:main with commit 8afcad8 Feb 26, 2026
10 checks passed
LucaCappelletti94 pushed a commit to LucaCappelletti94/sqlparser-rs that referenced this pull request Feb 27, 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