houqp / sqlvet

Go fearless SQL. Sqlvet performs static analysis on raw SQL queries in your Go code base.
MIT License
493 stars 25 forks source link

Add support for DELETE USING. Add check for missing WHERE clause in DELETE. #36

Closed ncabatoff closed 7 months ago

ncabatoff commented 7 months ago

Arguably this PR should be split into two, but I thought I'd first see whether the maintainer minded accepting them as a single PR, since it would've been a bit more work to split it.

The first change is to add support for DELETE USING statements.

The second change is to treat DELETE statements that don't have a WHERE clause, or that have a WHERE clause but without any column names in it, as an error. These are usually errors in my experience, and I'd prefer to have sqlvet refuse to allow them unless ignored.

houqp commented 7 months ago

Thanks @ncabatoff it's fine to keep it as a single PR, I will review later today

ncabatoff commented 7 months ago

Hey @houqp, just a reminder that this could use a review when you get a chance. Thanks!

houqp commented 7 months ago

sorry for the delay @ncabatoff , merged.

ncabatoff commented 7 months ago

Thanks!