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

Some Postgresql jsonb operators mistaken for prepared statement placeholders.

    XMLWordPrintable

    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:
      Linux/X11

      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

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            mabrand Mark Brand
            Reporter:
            fahad_alraddadi fahad alraddadi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes