Skip to content

fix: error when table variable used in scalar context#5585

Merged
max-sixty merged 1 commit intoPRQL:mainfrom
max-sixty:5158
Nov 29, 2025
Merged

fix: error when table variable used in scalar context#5585
max-sixty merged 1 commit intoPRQL:mainfrom
max-sixty:5158

Conversation

@max-sixty
Copy link
Copy Markdown
Member

Summary

  • Table variables defined with subqueries were silently discarded when used in scalar contexts (e.g., filter actor_id == mod_id), producing invalid SQL with literal identifiers
  • Added check in RqOperator handling to error when relation types are used as operator arguments
  • Clear error message with helpful hint: "use a join instead, or inline the subquery"

Fixes #5158

Test plan

  • Added test_table_variable_in_scalar_context test case
  • All 441 prqlc tests pass
  • Pre-commit lints pass
  • Verified existing s-string table interpolation tests still work

🤖 Generated with Claude Code

Table variables defined with subqueries were silently discarded when
used in scalar contexts like `filter actor_id == mod_id`, producing
invalid SQL with literal identifiers. Now produces a clear error with
a helpful hint.

Fixes PRQL#5158

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@max-sixty max-sixty merged commit d2b2a58 into PRQL:main Nov 29, 2025
35 checks passed
@max-sixty max-sixty deleted the 5158 branch November 29, 2025 19:43
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.

Variable is discarded silently with no type error

1 participant