Hello Bob, On Sat, 2018-04-14 at 15:44 +0100, Bob Jones wrote: > Hello, > > > > P.S. As a side-question, if anyone here has experience in using > Postgres as a backend to PHP, are refcursors the way to go or should > I > be thinking of SETOF or other return styles ? > If you have a business requirement along the lines of "display all outstanding orders for a customer" it is best to create a view that serves that purpose. Then all you need to code is a "select * from v_outstanding_orders where customer_id = $1"; If there are any outstanding orders you can page through the associative array returned by the query in order to display the results. HTH, Rob