lpsmith / postgresql-simple

Mid-level client library for accessing PostgreSQL from Haskell
Other
206 stars 71 forks source link

JSON question mark operators don't work #247

Open Vlix opened 6 years ago

Vlix commented 6 years ago

When trying to use the new (since PostgreSQL 9.4) operators on jsonb that contain question marks, the package incorrectly assumes they are parameters to be replaced with values by Database.PostgreSQL.Simple.buildQuery.

I propose a change to buildQuery that escapes ?? to ? without trying to count it as a to be replaced parameter. This is a very common method of escaping question marks in prepared statements afaik. I also don't expect anything breaking after this change, but if anyone knows of an instance this change may break something, do tell.

I can make a pull request if desired.

Vlix commented 6 years ago

I've made the pull request and updated it to include tests for the new jsonb operators