Skip to content

fix: qualify aliased selected attributes - #351

Open
elpete wants to merge 1 commit into
nextfrom
issue/40
Open

fix: qualify aliased selected attributes#351
elpete wants to merge 1 commit into
nextfrom
issue/40

Conversation

@elpete

@elpete elpete commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Closes #40

Issue review

Fit score: 9/10. Attribute-to-column translation is a core Quick promise and should continue to work when a select expression supplies an SQL alias, especially for asQuery() consumers.

Reasons for

  • makes aliased projections consistent with ordinary Quick selects
  • preserves entity property naming in direct query data
  • fixes the shared qualifier rather than adding a one-off query workaround

Reasons against

  • string parsing is limited to explicit AS, matching qb’s documented alias syntax
  • complex expressions are still better expressed with qb raw expressions

Implementation

  • recognizes case-insensitive source AS alias selections
  • qualifies/translates only the source attribute
  • preserves the caller-provided result alias

Reproduction

The public regression failed before the fix with MySQL Unknown column firstName in field list for select( "firstName AS firstName" ).asQuery( false ).

Validation

  • focused AsQuerySpec: 4 passed, 0 failed, 0 errors
  • full suite: 496 passed, 0 failed, 0 errors, 3 skipped
  • box run-script format
  • git diff --check
  • qb dependency: 14.0.0-beta.3

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.

1 participant