Re: JSONPath operator and escaping values in query

2024-07-04 Thread David G. Johnston
On Thu, Jul 4, 2024 at 1:57 PM Vasu Nagendra wrote: > > > SELECT '{"n": {"a-b": 1, "@ab": 2, "ab": 3}}'::jsonb @? '$ ? (@.n.a\-b >= 3)'; > > Which is better written as: select '{"n": {"a-b": 1, "@ab": 2, "ab": 3}}'::jsonb @? '$ ? (@.n."a-b" >= 3)'; Using the same double-quotes you defined the k

JSONPath operator and escaping values in query

2024-07-04 Thread Vasu Nagendra
Good afternoon, I am running into the following issue with a JSONPath exists query. This is a valid query SELECT '{"n": {"a-b": 1, "@ab": 2, "ab": 3}}'::jsonb @? '$ ? (@.n.ab >= 3)'; This is an invalid query (syntax error) SELECT '{"n": {"a-b": 1, "@ab": 2, "ab": 3}}'::jsonb @? '$ ? (@.n.a-b >=