Re: [BUGS] bug in "fetch" command?
Can someone comment on this? Is is a bug?
============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================Your name : Sergey E. Levov
Your email address : serg@informika.ruSystem Configuration
---------------------
Architecture (example: Intel Pentium) : Intel Pentium ProOperating System (example: Linux 2.0.26 ELF) : FreeBSD 2.2.5
PostgreSQL version (example: PostgreSQL-6.3.2) : PostgreSQL-6.3.2
Compiler used (example: gcc 2.7.2) : gcc 2.7.2.1
Please enter a FULL description of your problem:
------------------------------------------------
When I declare cursor for select statement without "ORDER BY" clause
( select * from <tablename> ), and then attempt to fetch record after
last record in table, or even just give "fetch all" command,
all the following "fetch" commands, regardless direction, will return
an empty result sets.
If "SELECT" statement has "ORDER BY" clause, all works well.Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
Try the following sequence of SQL operators:begin
declare mycurs cursor for select * from pg_user
fetch all in mycurs - OK
fetch backward all in mycurs - fails
move backward all in mycurs
fetch all in mycurs - fails
close mycursdeclare mycurs cursor for select * from pg_user order by usename
fetch all in mycurs - OK
fetch backward all in mycurs - OK
move backward all in mycurs
fetch all in mycurs - OKRegards,
Sergey Levov (serg@informika.ru)
--
Bruce Momjian | 830 Blythe Avenue
maillist@candle.pha.pa.us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)
Import Notes
Reply to msg id not found: pMjPHYrqcA@gate.informika.ru
Can someone comment on this? Is is a bug?
I was a bit suprised to see this behavior. I am guessing that it is a
bug. Does anyone else think so? I last tested and noticed this a week or
two ago when writing docs...
- Tom
Show quoted text
Please enter a FULL description of your problem:
------------------------------------------------
When I declare cursor for select statement without "ORDER BY" clause
( select * from <tablename> ), and then attempt to fetch record
after last record in table, or even just give "fetch all" command,
all the following "fetch" commands, regardless direction, will
return an empty result sets.
If "SELECT" statement has "ORDER BY" clause, all works well.
Try the following sequence of SQL operators:begin
declare mycurs cursor for select * from pg_user
fetch all in mycurs - OK
fetch backward all in mycurs - fails
move backward all in mycurs
fetch all in mycurs - fails
close mycursdeclare mycurs cursor for select * from pg_user order by usename
fetch all in mycurs - OK
fetch backward all in mycurs - OK
move backward all in mycurs
fetch all in mycurs - OK