X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EF49D5287D for ; Wed, 22 Jun 2005 04:24:45 -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 43799-03 for ; Wed, 22 Jun 2005 07:24:36 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7B3C25281C for ; Wed, 22 Jun 2005 04:24:34 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 86C183095A; Wed, 22 Jun 2005 09:25:43 +0200 (MET DST) From: "Sim Zacks" X-Newsgroups: pgsql.sql Subject: Re: scroll cursor bug or me? Date: Wed, 22 Jun 2005 10:22:04 +0200 Organization: Hub.Org Networking Services Lines: 58 Message-ID: References: X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.351 tagged_above=0 required=5 tests=AWL, PRIORITY_NO_NAME, UPPERCASE_25_50 X-Spam-Level: * X-Archive-Number: 200506/330 X-Sequence-Number: 21931 It seems to me that scroll cursors are not valid in plpgsql. The following query in PGAdmin works. run one line at a time. begin work; declare bob scroll cursor for select * from testtbl; fetch forward 5 from bob; fetch prior from bob; rollback work; "Larry Morroni" wrote in message news:QrSdnW6Ltdl8jyXfRVn-vQ@comcast.com... > Hi, I am hitting an issue when using SCROLL CURSORS. > > -->My Setup: > PostgreSQL 8.0.3 on Windows XP Pro SP2 > > > -->My Test Function: > CREATE OR REPLACE FUNCTION TestFunction () RETURNS varchar(50) AS > $$ > DECLARE CursorProductGroups SCROLL CURSOR FOR SELECT * FROM TEST_TABLE; > BEGIN > RETURN NULL; > END; > $$ > LANGUAGE plpgsql > ; > > -->psql spits back the following: > > STORE_PHYSICAL_A=# \i test.sql > psql:test.sql:9: ERROR: syntax error at or near "CURSOR" > CONTEXT: invalid type name "SCROLL CURSOR FOR SELECT * FROM TEST_TABLE" > compile of PL/pgSQL function "testfunction" near line 1 > STORE_PHYSICAL_A=# > > This seems like a bug to me because my demo looks > just like the examples given in the PostgreSQL documentation. ie... > > -- BEGIN POSTGRES DOC EXAMPLE > BEGIN WORK; > DECLARE liahona SCROLL CURSOR FOR SELECT * FROM films; > FETCH FORWARD 5 FROM liahona; > CLOSE liahona; > COMMIT WORK; > -- END POSTGRES DOC EXAMPLE > > Any ideas? > > Larry Morroni