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

QPSql requests TableName excessively when reading resultset from stored-procedures

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.11.0 Alpha
    • 5.10.1
    • SQL Support
    • None

    Description

      If I have a Postgre database (I'm using 9.6) that has a stored procedure in the form:

      CREATE OR REPLACE FUNCTION public.get_nuid_report(IN _product_id nkey)
        RETURNS TABLE(item_id nkey48, pn text, casn text, nuid text, c_nb text, sn text, csc_n text, ua text, casn12 text) AS[...]

      And I use a QSqlQuery with;

      select * from {{get_nuid_report(}}X);

      I see that QPsql driver sends hundreds of queries to the server, all identical making my software unusable due to its slowness:

      SELECT relname FROM pg_class WHERE pg_class.oid = 0

      Looking at the driver source, I see that it is trying to get the table name for this query, which is invalid since the OID is zero.

      Using the patch attached, where I check if tableOid > 0 before running the query to return the table name, I eliminate the problem altogether.

      Attachments

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

        Activity

          People

            mabrand Mark Brand
            gianni Gianni Rossi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes