Re: MOVE strangeness
От | Bruce Momjian |
---|---|
Тема | Re: MOVE strangeness |
Дата | |
Msg-id | 200212262224.gBQMOHi10006@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: MOVE strangeness (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
Tom Lane wrote: > Bruce Momjian <pgman@candle.pha.pa.us> writes: > > Sorry, I am not understanding. If he does: > > ... > > here, isn't he sitting at the start of the fourth row, no? > > No. He is sitting *on* the third row. If he now does FETCH 1, he will > advance to and return the fourth row; on the other hand, if he does > FETCH -1, he will back up to and return the second row. OK, and it makes sense FETCH -1 will move back a row rather than re-reading the row. > The cursor must be considered to be positioned on its current row, not > between rows, or the SQL-defined operations UPDATE WHERE CURRENT OF and > DELETE WHERE CURRENT OF don't make any sense. (We don't support those > yet, but we should someday.) Yes, that's where the positioning makes sense. > BTW, looking at Date and the SQL spec, I now realize that the recently > made change to convert FETCH 0 into a no-op is wrong; per spec, FETCH > RELATIVE 0 means "re-fetch the current row, if any". By analogy, MOVE 0 > should probably return "MOVE 1" if you are on a real row, "MOVE 0" if > you are not, corresponding to the number of rows you'd have gotten from > FETCH 0. Ugly, but ... OK, I will fix those. I am working on it now. I think I am going to have to break the internal representation that a zero fetch means fetch all. Right now, we use INT_MAX for fetch all in PerformPortalFetch. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
В списке pgsql-hackers по дате отправления: