You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I have a Query builder macro in my application that checks if a JSON column contains any of the provided values. There is no built-in laravel function for this so I use a raw statement for this.
?| operators is used checks if any of the specified values exist in jsonb array. ??| in this is used to escape ? so query builder does not view this as a binding placeholder.
The query is executed successfully but telescope does not report the correct query.
Telescope result:
select"id"from"movies"where"release_date" between '2023-02-05 00:00:00'and'2024-02-05 00:00:00'and ("categories") :: jsonb @ >'["action"]'and categories 'thriller''crime' | array ['adventure','one-man-army','one-person-army-action']
and keywords 'spy''terrorist' | array ['mission','secret-agent','action-hero','assasin','intelligence-service',?,?,?,?]
order by"rank"desclimit21 offset 0
Expected result:
select"id"from"movies"where"release_date" between '2023-02-05 00:00:00'and'2024-02-05 00:00:00'and ("categories") :: jsonb @ >'["action"]'and categories ?| array ['thriller', 'crime', 'adventure']
and keywords ?| array ['one-man-army','one-person-army-action','spy','terrorist','mission','secret-agent','action-hero','assasin','intelligence-service']
order by"rank"desclimit21 offset 0
Another minor issue is the space between @> which throws an error if you copy and execute the query directly.
Steps To Reproduce
Wrtie a raw statement using an ?| operator comparing a jsonb array column for postgresql.
The text was updated successfully, but these errors were encountered:
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
Telescope Version
4.17.5
Laravel Version
10.43.0
PHP Version
8.1.21
Database Driver & Version
PostgreSQL 15.3 (Debian 15.3-1.pgdg120+1)
Description
Hello, I have a Query builder macro in my application that checks if a JSON column contains any of the provided values. There is no built-in laravel function for this so I use a raw statement for this.
?|
operators is used checks if any of the specified values exist in jsonb array.??|
in this is used to escape?
so query builder does not view this as a binding placeholder.The query is executed successfully but telescope does not report the correct query.
Telescope result:
Expected result:
Another minor issue is the space between
@>
which throws an error if you copy and execute the query directly.Steps To Reproduce
Wrtie a raw statement using an
?|
operator comparing a jsonb array column for postgresql.The text was updated successfully, but these errors were encountered: