X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E52D3D80C2 for ; Wed, 5 Oct 2005 12:05:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33997-01 for ; Wed, 5 Oct 2005 15:05:28 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id D9F60DA1E7 for ; Wed, 5 Oct 2005 12:05:27 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 65D4740BFC4; Wed, 5 Oct 2005 16:05:15 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id BDE4115EDB; Wed, 5 Oct 2005 16:01:22 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 20750-10; Wed, 5 Oct 2005 16:01:16 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 4937D15EDA; Wed, 5 Oct 2005 16:01:16 +0100 (BST) Message-ID: <4343EABB.6030808@archonet.com> Date: Wed, 05 Oct 2005 16:01:15 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050912) X-Accept-Language: en-us, en MIME-Version: 1.0 To: andrew@pillette.com Cc: pgsql-sql@postgresql.org Subject: Re: MOVE in SQL vs PLPGSQL References: <200510051417.j95EH0518161@pillette.com> In-Reply-To: <200510051417.j95EH0518161@pillette.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.057 required=5 tests=[AWL=0.007, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/36 X-Sequence-Number: 22889 andrew@pillette.com wrote: >> Andrew - your question doesn't seem to make sense - can you give >> some more details? Are you having some problem with cursors in >> plpgsql? > > > Yes. I'd like the effect of the plain SQL MOVE with a PLPGSQL cursor. > I'm writing a procedure for which SQL is inadequate (I need > condiitonal branches and looping). However, in PLPGSQL, it appears > the only way to fast forward on a cursor is a repeated FETCH, which > is wasteful. PLPGSQL doesn't even allow me to set up a SQL-type > cursor using EXECUTE--I have to use the refcursor datatype and it > doesn't appear to support MOVE. > > I could write a procedure client-side in (say) Java without any > problem using absolute or relative move, but I'd like the procedure > to run on the server. Ah, now I see what you're saying. You're quite right in your suspicions, "MOVE..." isn't supported for plpgsql cursors. You could probably do something with EXECUTE and returning a refcursor from a previous function, but that sounds fiddly. I must admit, on the odd occasion I want to skip a row, I just FETCH it and move on. Anyone else? -- Richard Huxton Archonet Ltd