Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-96636

Some Postgresql jsonb operators mistaken for prepared statement placeholders.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.7.0 FF
    • 5.15.1, 6.0
    • SQL Support
    • None
    • Ubuntu 20.04
      Postgresql 12
      Qt 5.15.1
    • All
    • e532933a2 (dev)

    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';

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-96636
          # Subject Branch Project Status CR V

          Activity

            People

              chehrlic Christian Ehrlicher
              fahad_alraddadi fahad alraddadi
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes