Re: MOVE strangeness

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: Kevin Brown <kevin(at)sysexperts(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: MOVE strangeness
Date: 2002-12-30 18:50:52
Message-ID: qg211v00stnimof0q7nu035kejo8pd324s@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Sun, 29 Dec 2002 16:39:37 -0800, Kevin Brown <kevin(at)sysexperts(dot)com>
wrote:
>> > Okay. But then doesn't it make sense for FETCH to fetch the contents
>> > of the row (and subsequent requested rows) that the cursor is
>> > currently on *then* move, and not the other way around?

>This model is extremely common and, IMO, sensible.

OTOH, seeing a row *before* updating or deleting it is *extremely*
useful. Here is what you are proposing:

SELECT * FROM t ORDER BY id;
id | txt
---+---------------
1 | leave me alone
2 | delete me
3 | keep me

BEGIN;
DECLARE c CURSOR FOR SELECT * FROM t ORDER BY id;
FETCH 1 FROM c;
id | txt
---+---------------
1 | leave me alone

-- ok, leave it alone ...

FETCH 1 FROM c;
id | txt
---+---------------
2 | delete me

-- got it! (really??)
DELETE FROM t WHERE CURRENT OF c;
COMMIT;

SELECT * FROM t ORDER BY id;
id | txt
---+---------------
1 | leave me alone
2 | delete me

-- oops!!

> just as you'd expect

No, not me. Would *you* expect this? If you really want to draw an
analogy between databases and editors, compare rows to lines, not
characters. Now imagine an editor window just one line high, then it
is clear that after a row is brought into the window you don't want
the cursor to silently advance to the next (invisible) row.

Servus
Manfred

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2002-12-30 21:31:45 Re: why was libpq.so's version number bumped?
Previous Message Tara Piorkowski 2002-12-30 16:09:55 Bug in Dependencies Code in 7.3.x?

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-12-30 20:50:12 Re: Makefiles for Borland C 5.5 compiler
Previous Message Bruce Momjian 2002-12-30 04:43:57 Re: Makefiles for Borland C 5.5 compiler