-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Description
- Laravel Version: > 8.81
- PHP Version: used > 7.4.16
- Database Driver & Version: pgsql & postgresql v12-14
Description:
Since this commit a9c5009
we get unnecessary "!= 0" in SQL statements.
Steps To Reproduce:
In Tinker:
App\Models\Occupation::query()->where('real_estate_id',59)->where('date_range', '>>','[2022-01-08 00:00:00,2022-01-09 00:00:00)')->toSql();
SQL output with >v8.81:
=> "select * from "occupations" where "real_estate_id" = ? and ("date_range" >> ?) != 0 and "occupations"."deleted_at" is null"
SQL output with <v8.81:
=> "select * from "occupations" where "real_estate_id" = ? and "date_range" >> ? and "occupations"."deleted_at" is null"
Error:
Illuminate\Database\QueryException with message 'SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: boolean <> integer
LINE 1: ...re "real_estate_id" = $1 and ("date_range" >> $2) != 0 and "...
HINT: No operator matches the given name and argument types. You might need to add explicit type casts. (SQL: select * from "occupations" where "real_estate_id" = 226 and ("date_range" >> [2022-01-08 00:00:00,2022-01-09 00:00:00)) != 0 and "occupations"."deleted_at" is null limit 1)'
Why changes are made on a9c5009#r65853324 e.G. ?