Re: scroll cursor bug or me? - Mailing list pgsql-general

From Sim Zacks
Subject Re: scroll cursor bug or me?
Date
Msg-id d9b3pr$1bji$1@news.hub.org
Whole thread Raw
List pgsql-general
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" <lam170@yahoo.com> 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



pgsql-general by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: ANN: PG Lightning Admin for PostgreSQL 8.x Released
Next
From: Gregory Youngblood
Date:
Subject: Clustering and replication options