Skip to content

Allow selective disabling of rules per query #3619

Closed
@rhodeon

Description

@rhodeon

What do you want to change?

Currently, the only way to disable the vetting of rules for a query is with the @sqlc-vet-disable flag.
The problem with this is that it is an "all-or-nothing" approach. When provided, that flag disables the vetting of all rules for the query including some which might be needed.
It would be good to be able to provide a list of rules to skip, like:

/* @sqlc-vet-disable sqlc/db-prepare no-exec */

In this case, only the 2 listed rules in the comment would be skipped, but all others would run.
When no rule is provided, the flag should disable all rules in the query, just like the current behaviour, for backwards-compatibility.

Use Case

I have a basic no-delete-without-where rule which needs to be disabled for a few queries, but the current way to do that involves skipping all rules for the affected queries.

What database engines need to be changed?

PostgreSQL, MySQL, SQLite

What programming language backends need to be changed?

No response

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