Cursor queries & fetches - Mailing list pgsql-hackers

From Steve Howe
Subject Cursor queries & fetches
Date
Msg-id 9kg6d1$1i69$1@news.tht.net
Whole thread Raw
List pgsql-hackers
Hello all,
       I've noted that the MOVE command won't send you an error message if
you try to position the cursor AFTER the actual end of the records. Is this
ok ??? I think it should return a proper error code and message, but
instead, it will return only an empty recordset.

The following code will demonstrate what I mean:

rollback;begin;declare Test cursor for select typname from pg_type;move
10000 in Test;fetch 10 in Test;close Test;end;

I think 'move 10000' should raise an error...
Any comments ?
Does Oracle or other DBMSs act like this ?

I have another questions, since I can't find answers anywhere on the
documentation...
1) can DECLARE be modified to return the number of rows in the resultset,
maybe by adding some new parameter ?... Or it would it require to execute
the whole query before returning this value ?...
2) How does cursor queries really work: they execute the query, store all
rows in memory, and then pass small resultsets retrieved by FETCH commands
on the client, or does it produces and retrieves each recorset as each FETCH
command is issued ??

Best Regards,
Steve Howe




pgsql-hackers by date:

Previous
From: Giles Lean
Date:
Subject: Re: SIGCHLD handler in Postgres C function.
Next
From: Bruce Momjian
Date:
Subject: Re: patch for contrib/intarray (current CVS)