limit?

Started by Michael Meskesover 25 years ago2 messages
#1Michael Meskes
meskes@postgresql.org

Is limit ignored in a cursor definition? I just was send a source that ecpg
seemed to have problems with:

...
EXEC SQL DECLARE H CURSOR FOR
select id,name from ff order by id asc limit 2;
EXEC SQL OPEN H ;

while(1){
EXEC SQL FETCH IN H INTO :id,:name ;
printf("%d-%s\n",id,name.arr);
}
...

I never before tried this and one could easily program this functionality
wihtout limit, but I still wonder if it's correct that limit is ignored. BTW
I only tested it with 6.5.3.

Michael
--
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Michael Meskes (#1)
Re: limit?

Michael Meskes <meskes@postgresql.org> writes:

Is limit ignored in a cursor definition?

Yes. Seems to me we discussed that and decided it was a feature,
not a bug. Check the archives if you want to know why; I don't
recall.

If we do believe that, though, probably DECLARE CURSOR ... LIMIT
ought to give an error, instead of silently ignoring the limit
as it does now.

regards, tom lane