Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f7gZG-0005ho-Nq for pgsql-general@arkaria.postgresql.org; Sun, 15 Apr 2018 12:15:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f7gZF-0005W9-Fq for pgsql-general@arkaria.postgresql.org; Sun, 15 Apr 2018 12:15:37 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f7gZF-0005Vz-1o for pgsql-general@lists.postgresql.org; Sun, 15 Apr 2018 12:15:37 +0000 Received: from mail-pl0-x230.google.com ([2607:f8b0:400e:c01::230]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1f7gZ8-0003XO-QS for pgsql-general@postgresql.org; Sun, 15 Apr 2018 12:15:35 +0000 Received: by mail-pl0-x230.google.com with SMTP id e7-v6so8520169plt.6 for ; Sun, 15 Apr 2018 05:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:date:in-reply-to:references:mime-version :content-transfer-encoding; bh=733Kkci46f0ZsH4Qe6kcvwgBVQpvDE4iwaQwLFjqnbg=; b=DHRZ2xQVxTZ757acGZYjj9Fm2CwhQxaWB+XdoUxaE717LJGxliIUhmwAkiIsbDOcmk MxDpGXUeaJeRxkQWhNbfJnF+1EiZEOd5IQ0t1TSyeGxQy96JxshErMcGEc0vpEwbh9Ly FZKRscDq/Uq/m/ODksq2ULn3BCVRbwNJsXz6FkQl/MeRbN/Kko2R0/jz9upZxLJ5MaXU 7RwZ7FHyCRG2BZy2YtyTjcb3J4R3BwzPeI55ciHvBmdtG5LNA1VEDQElv7chQIqwO7re YsiQ1IavzeyhfiHOrKhFO5D3nhOPWl2cjG5S2zvTeLnmCf98+W2GE4jEBb+8T4MbySTI tJdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=733Kkci46f0ZsH4Qe6kcvwgBVQpvDE4iwaQwLFjqnbg=; b=CkwABVAuwamlFz2XtOEOxAnEIaqx3wMQ58lkNwSJYudU2eZ9m8uPoYD2tlESTXqt5n RqYcN4n3ZcGIiqkfcf0dF0DIdYBw7zcvwvo7BpTDmXIV9Z3D5hcswuOiXirB36TL/xe1 KhXZBihN7rYk1WV8PXCrrBBogEh7fjb8gVh1NcAfFhhsF7dQKLA/nYhQKOo40BtnQ8Kk Vpo4FNKDDVVrm9SgaoPd2kAsV0XPBhVcZ+g6VLad2mpXZcibLzaDr2e692+HezL42qFW NlxEk2OUNPDL+YWt1tyv30IVfHjKhazEEenSm13+s5rASJFgF5N4flNuiaMp3SBJAM/X BHGA== X-Gm-Message-State: ALQs6tCE1EMLPNE8ZrWIv0YivD+CXdaiLFGGgVWxpv37VqzZeCLTcoc4 JbXCMfZ1HG2AMgkrYuYYlc4= X-Google-Smtp-Source: AIpwx4+5kq/sQX27TtQ11+pB5NzagVmHldF3TvYKcEGB0xSmoYteobEvYtGkOvqnaLdjlaGMFfmF3g== X-Received: by 2002:a17:902:6a01:: with SMTP id m1-v6mr5402934plk.220.1523794528927; Sun, 15 Apr 2018 05:15:28 -0700 (PDT) Received: from roblaptop (d49-188-135-3.sun2.vic.optusnet.com.au. [49.188.135.3]) by smtp.gmail.com with ESMTPSA id g21sm17309709pfi.143.2018.04.15.05.15.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 15 Apr 2018 05:15:28 -0700 (PDT) Message-ID: <1523794523.3515.6.camel@gmail.com> Subject: Re: cursor "x" does not exist From: rob stone To: Bob Jones , pgsql-general Date: Sun, 15 Apr 2018 22:15:23 +1000 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.2-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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