Skip to content

fix: report a repeated argument in the prql query header - #6384

Open
prql-bot wants to merge 2 commits into
mainfrom
fix/duplicate-query-header-args
Open

prql-bot wants to merge 2 commits into
mainfrom
fix/duplicate-query-header-args

Conversation

@prql-bot

@prql-bot prql-bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

A prql query header that repeats an argument now fails with duplicate query definition arguments instead of quietly using the last value. Before this, query_def collected the header's arguments into a HashMap, so each repeat overwrote the earlier value. This compiles with Postgres's LIMIT, not MSSQL's TOP:

$ printf 'prql target:sql.mssql target:sql.postgres\nfrom t\ntake 3\n' | prqlc compile
SELECT
  *
FROM
  t
LIMIT
  3

The same applies to version: in prql version:"0.1" version:"^0.13" the 0.1 requirement, which the compiler would otherwise reject, was discarded without a message.

The new error points at the header span and names every repeated argument, matching the existing unknown query definition arguments diagnostic next to it. The regression test query_def_duplicate_argument in prqlc-parser/src/parser/stmt.rs fails without the check and passes with it. Locally, cargo test -p prqlc-parser and cargo clippy -p prqlc-parser --all-targets -- -D warnings both pass.

Found by the nightly survey of prqlc-parser/src/parser/stmt.rs.

This branch has not been deployed

No deployments
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