Open AndreaGero opened 3 months ago
Same issue here !
HTTP Request:
curl --location --globoff 'http://localhost:8000/transactions?filter[type]=AO,OE' \
--header 'Accept: application/json'
Facing this issue as well!
Package Version 5.8.1 PHP Version 8.3
Downgraded again to get it working
The issue is introduced in version 5.8.1. The source of issue is in aravel-query-builder/src/Filters /FiltersPartial.php file function maybeSpecifyEscapeChar
Removing the append of the ESCAPE override resolves the problem on PSQL. As far as it overrides the default escape character using the same default value it seems unclear the reason of why this function was added originally.
+1
+1
Seems like it exists on version 6.0.1 as well
Seems like it exists on version 6.0.1 as well
Yes, I am still using 5.8 for now
Same issue
Can confirm that last version without this bug is 5.8.0
Creator of the mentioned PR that causes the bug.
@GregoryGagua - To answer your doubt, the maybeSpecifyEscapeChar was added because an unexpected behavior happened while using the package with sqlite. Adding the explicit ESCAPE solves the issue. You can find more info and the testing I did in the dedicated PR #927.
I'm currently trying to debug and fix the issue. The easy solution would be to avoid adding the explicit ESCAPE while using the pgsql driver. According to my testing, it should both fix the 'Invalid parameter number' error and not re-introduce the bug fixed in the original PR, since pgsql was not affected by the bug itself (but supports explicit ESCAPE, so that's why it was included in the drivers to "escape").
If I won't be able to find a better/more complete solution, I will open a new PR proposing the fix I just described, so at least you all could update the dependency if merged.
I'll update this thread in case of any news, thanks to everybody! :)
(special thanks to @dwightwatson for mentioning the PR and bringing this issue to my attention)
With the version 5.8.1 there is an issue with multiple partial filters, the query builder throw an error:
SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
select count(*) as aggregate from "users" where LOWER("users"."name") LIKE %vella% ESCAPE '\' and LOWER("users"."email") LIKE %rea% ESCAPE '\'
The query seems ok, I've tested with Laravel 11.7.0 and Postgres 16 and also on Postgres 14 .