Does this provide more information?
I am sorry, but I have reached the limit of my ideas. Perhaps someone else with more experience can provide some help.

Have you tried doing this with a "toy" database - something very simple where you do the same set of SQL procedures, but with a very small and simple DB? That might help you determine whether it is a Qt problem, a PostgreSQL problem, a DB schema problem, or some combination.