sfackler / rust-postgres

Native PostgreSQL driver for the Rust programming language
Apache License 2.0
3.43k stars 436 forks source link

Issues working with jsonb queries. #1035

Closed xd009642 closed 1 year ago

xd009642 commented 1 year ago

I'm using jsonb in my table and have a where condition like WHERE NOT my_json->'duration' = 'null'. Only when it gets sent to postgres via 'query_opt' postgres receives WHERE NOT my_json->duration = 'null' which is an invalid query and returns an error. Is there a way I can get tokio_postgres to not interpolate this string and break the query?

This is also for a quick-and-dirty dev tool that will never see prod so I'm fine with something a bit hacky/unsafe.

xd009642 commented 1 year ago

Oh hang on my bad was looking at the wrong query