X-Original-To: pgsql-interfaces-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 3DCA49FA48D for ; Tue, 12 Sep 2006 07:19:22 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 28868-01 for ; Tue, 12 Sep 2006 07:19:14 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.183]) by postgresql.org (Postfix) with ESMTP id EF1E29FA45F for ; Tue, 12 Sep 2006 07:19:13 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d80so2582417pyd for ; Tue, 12 Sep 2006 03:18:39 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=OnyT4KeGC/6gmW740vdYLckF/yufwbmFhvvin3Untcf5hcGN/fRJ8TOsapMXvYw/m6TqH8wSUfoYNnHGu1gpGcIhw6tGewH+DZ9gfyAE5+Hc/fgfhnP/EluZgqtscG8sxn3zFSgLN2Z9H3F0M+v9/psBY1QC9+UNI5lxe4rUV5o= Received: by 10.35.40.10 with SMTP id s10mr10576343pyj; Tue, 12 Sep 2006 03:18:39 -0700 (PDT) Received: by 10.35.115.8 with HTTP; Tue, 12 Sep 2006 03:18:39 -0700 (PDT) Message-ID: Date: Tue, 12 Sep 2006 12:18:39 +0200 From: Andro To: pgsql-interfaces@postgresql.org Subject: cursors on prepared queries MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1142_17148120.1158056319216" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.99 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, HTML_10_20, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200609/2 X-Sequence-Number: 6247 ------=_Part_1142_17148120.1158056319216 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, there isn't any interface for using cursors within libpq, I'll do with a PQexec(conn,"DECLARE..."); and fetch. Now I'd like to know if it's possible to prepare a query (that takes forever to plan) and execute it into a cursor, like (SQL) : PREPARE plan_name(int) AS SELECT * FROM abc WHERE a = $1; DECLARE cur CURSOR FOR EXECUTE(3); doing so, I get a 'syntax error at or near "EXECUTE" at character 24' Is something wrong or is it just not supported by postgres? Manual talks about read only cursors but I didn't find out discussions about "anti-prepared-statement-cursors". I'm using postgres-8.1.4. Any help appreciated! Thanks Charles ------=_Part_1142_17148120.1158056319216 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi,

there isn't any interface for using cursors within libpq, I'll do with a PQexec(conn,"DECLARE..."); and fetch.
Now I'd like to know if it's possible to prepare a query (that takes forever to plan) and execute it into a cursor, like (SQL) :

PREPARE plan_name(int) AS SELECT * FROM abc WHERE a = $1;
DECLARE cur CURSOR FOR EXECUTE(3);

doing so, I get a 'syntax error at or near "EXECUTE" at character 24'

Is something wrong or is it just not supported by postgres?
Manual talks about read only cursors but I didn't find out discussions about "anti-prepared-statement-cursors".

I'm using postgres-8.1.4.

Any help appreciated!

Thanks

Charles
------=_Part_1142_17148120.1158056319216--