Skip to content

Binding issue with ?| operator using whereRaw with Postgres #30990

@raphaelmsr

Description

@raphaelmsr
  • Laravel Version: 6.6.0
  • PHP Version: 7.4.1
  • Database Driver & Version: PostgreSQL 10.11

Description:

I've been trying to query whereRaw with a ?| operator but although it is in the PostgresGrammar, it keeps on being binded by a value, either being replaced if I give a variable, or a binding error regarding the counts of binded parameters
Currently i am using jsonb_exists_any but it is somehow much slower to ?|

Steps To Reproduce:

Query :
$model->whereRaw('("column")::jsonb ?| array?', str_replace('"',"'",json_encode($array)));

with pgsql driver will replace ?| with the first binded paramater of whereRaw

EDIT :
I know why it is much slower now ...
https://dba.stackexchange.com/questions/90002/postgresql-operator-uses-index-but-underlying-function-does-not

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions