Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.10.1
-
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.