Details
-
Type:
Bug
-
Status: Reported
-
Priority:
P3: Somewhat important
-
Resolution: Unresolved
-
Affects Version/s: 5.15.1
-
Fix Version/s: None
-
Component/s: SQL Support
-
Labels:None
-
Environment:Ubuntu 20.04
Postgresql 12
Qt 5.15.1
-
Platform/s:
Description
When trying to prepare a query that uses the '@?' jsonb operator, Qt confuses that operator for a query parameter (because of the '?').
Here is a fiddle that demonstrates the behavior:
https://www.db-fiddle.com/f/4jyoMCicNSZpjMt4jFYoz5/2444
And in case the fiddle goes down, here are the commands it runs:
CREATE TABLE my_table (my_column jsonb);
INSERT INTO my_table (my_column) VALUES ('
{"a":[1, 2]}');
– Trying to prepare something of the form
– SELECT * FROM my_table WHERE my_column @? :condition;
– Doesn't work in Qt. The '?' in the '@?' operator is mistaken for a parameter.
SELECT * FROM my_table WHERE my_column @? '$.a[*] ? (@ == 1)';
– Works. The '@@' operator can't be a parameter
SELECT * FROM my_table WHERE my_column @@ '$.a[*] == 1';