Skip to content

db query rejects any SQL argument starting with '--' (commander parses it as an option) #280

Description

@agent-zhang-beihai

What happens

Piping a migration file into 'db query' fails whenever the file begins with a SQL line comment, which is the normal way to head a migration. commander treats the leading '--' as an unknown option and prints the entire SQL body as the option name. '--' as an argument separator does not help (it then reports 'too many arguments'). Repro: npx @insforge/cli db query "$(cat 0007-helpers.sql)" where the file starts with '-- Unit 3 / migration 0007'.

Expected

The positional SQL argument should be taken verbatim regardless of leading dashes.

Workaround

Prepend a '/* validate */' block comment to the SQL string before passing it.

Triage finding

Reproduced on latest published 0.2.8 (not just the reported 0.2.1) — db query with SQL starting with -- dies at commander argv parsing with error: unknown option '<entire SQL body>'; no passThroughOptions/enablePositionalOptions anywhere in src, no fix on main, not a dupe of #277/#259 (those are backend FORBIDDEN rejections), and the CLI's own create.ts:717 recommends the exact failing command — note the report is wrong that -- fails, db query -- "<sql>" works and is a better interim workaround than the block-comment hack.

· darwin 25.5.0

Filed automatically from user feedback.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions