sqlvalidator
sqlvalidator copied to clipboard
Validation of bool for WHERE clause might be unnecessary
There are SQL queries that don't have a bool type in the where clause (e.g.: the usage of JSON_CONTAINS_PATH). https://github.com/David-Wobrock/sqlvalidator/blob/6b8732359e4c43c68d3550a10df5eea115417c1c/sqlvalidator/grammar/sql.py#L250 should be the place to change this.
Hi @tatulea, thanks for opening an issue :) mysql/MariaDB indeed supports WHERE conditions on other column types than boolean. Good catch, thanks for reporting it.
I based myself on postgresql, where the condition is stricter:
ERROR: argument of WHERE must be type boolean, not type integer
LINE 1: select * from sometable where id;
I'll probably make the validation a bit more permissive for now (even though the validation is only partly implemented)