Skip to content

Fix select_as aliases in combined selects - #3194

Merged
Huliiiiii merged 2 commits into
SeaQL:masterfrom
boopy253:fix/3174-preserve-select-alias
Sep 5, 2026
Merged

Fix select_as aliases in combined selects#3194
Huliiiiii merged 2 commits into
SeaQL:masterfrom
boopy253:fix/3174-preserve-select-alias

Conversation

@boopy253

@boopy253 boopy253 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #3174.

Root cause

A column-level select_as transform changes the projection from a column expression into a cast expression. Combined selects prefix the first-entity projection aliases, but can only infer an unaliased projection name from a plain column or an enum cast. As a result, find_also_related and the other combined-select paths panic before executing SQL.

Fix

Preserve the column logical name as the projection alias whenever select_as produces a transformed expression. Plain columns and the existing enum path retain their previous SQL shape. Apply the same behavior to default entity projections and QuerySelect::column, and mirror it in sea-orm-sync.

Verification

  • Reproduced the original panic with the reported citext mapping in an isolated crate.
  • Executed the fixed query end to end against PostgreSQL 18 with the citext extension, including model decoding and case-insensitive filtering.
  • Added regression coverage for default and select_only combined selects.
  • Passed cargo test --workspace, the full PostgreSQL integration matrix, the sea-orm-sync SQLite matrix, feature checks, Clippy with warnings denied, rustfmt, and Taplo formatting.

Fixes SeaQL#3174.

AI-Assisted-By: OpenAI Codex
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-05T17:54:56.347620Z df8239f New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Huliiiiii
Huliiiiii merged commit 6f0798f into SeaQL:master Sep 5, 2026
32 checks passed
@Huliiiiii

Copy link
Copy Markdown
Member

Thanks!

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.

find_also_related panics on entities generated by sea-orm-cli for citext columns

2 participants