Skip to content

fix: bare select() over a subquery or union selects every alias - #43

Merged
Makisuo merged 2 commits into
fix/typed-errors-not-throwsfrom
fix/fromquery-select-all
Oct 23, 2026
Merged

Makisuo merged 2 commits into
fix/typed-errors-not-throwsfrom
fix/fromquery-select-all

Conversation

@Makisuo

@Makisuo Makisuo commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

CH.fromQuery(inner, "w").select() and CH.fromUnion(u, "u").select() died with QueryBuilderDefect: select() is required, though the type says "every column". A derived source has no column list until its own SELECT is evaluated, so the expansion was empty. It is now resolved at compile from the source's aliases (typed or not).

Verification: tests in subquery.test.ts for both sources; the plan fuzzer wraps about half its plans this way — 12k queries vs the model at 20×, previously all skipped; full suite.


Stack (merge bottom-up):

  1. test(fuzz): property-based fuzzer for the query builder #39 test(fuzz): property-based fuzzer for the query builder
  2. fix(clickhouse): write number literals that read back exactly #40 fix(clickhouse): write number literals that read back exactly
  3. fix: parenthesise an arithmetic expression passed as an argument #41 fix: parenthesise an arithmetic expression passed as an argument
  4. fix: fail with QueryBuilderError instead of throwing on unusable values #42 fix: fail with QueryBuilderError instead of throwing on unusable values
  5. fix: bare select() over a subquery or union selects every alias #43 fix: bare select() over a subquery or union selects every alias
  6. fix(clickhouse): cast array and map comparison literals to the column type #44 fix(clickhouse): cast array and map comparison literals to the column type
  7. fix(postgres): type the two placeholders Postgres would mistype #45 fix(postgres): type the two placeholders Postgres would mistype

🤖 Generated with Claude Code

`select()` with no arguments expanded the source's declared columns. A
derived source (`fromQuery`, `fromUnion`) has none until its SELECT is
evaluated, so the expansion was empty and compile died with
`select() is required` — though the type promised every column. The
expansion now waits for compile, which reads the source's aliases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Makisuo
Makisuo added this pull request to stack #46 October 23, 2026 00:18
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4b38db55-aedb-4ba9-b5e1-38cf38178e5d
📥 Commits

Reviewing files that changed from the base of the PR and between 1ac7d0a and 559f860.

📒 Files selected for processing: 5
  • .changeset/fromquery-select-all.md
  • src/ch/compile.ts
  • src/ch/query.ts
  • src/ch/subquery.test.ts
  • tests/fuzz/known-issues.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Makisuo Makisuo changed the title fix: bare select() over a subquery or union selects every alias fix: fail with QueryBuilderError instead of throwing on unusable values Oct 23, 2026
@Makisuo Makisuo changed the title fix: fail with QueryBuilderError instead of throwing on unusable values fix: bare select() over a subquery or union selects every alias Oct 23, 2026
@Makisuo
Makisuo merged commit 362e880 into main Oct 23, 2026
5 checks passed
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