From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Neil Conway <neilc(at)samurai(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: updateable cursors & visibility |
Date: | 2003-03-31 17:59:41 |
Message-ID: | Pine.LNX.4.44.0303311633050.4632-100000@peter.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane writes:
> Serializable or not, there is a good case for saying that cursors don't
> see changes made after they are opened, period.
No one disputes that insensitive cursors are a valid concept. But this
discussion is about updating such a cursor. What view of the data would
such a cursor represent after an update? What about this example:
CREATE TABLE foo (a int PRIMARY KEY);
INSERT INTO foo VALUES (1);
... much later ...
BEGIN;
DECLARE test INSENSITIVE CURSOR FOR UPDATE FOR SELECT a FROM foo;
INSERT INTO foo VALUES (2);
FETCH NEXT FROM test;
UPDATE foo SET a = 2 WHERE CURRENT OF test;
...
COMMIT;
Does the UPDATE catch the constraint violation?
> If we allow the snapshot to change later, what in the world will the
> semantics be? Will we go back to re-scan rows that we previously
> skipped?
Clearly this issue is yucky, that's why they probably invented asensitive
cursors. I wouldn't be surprised to learn that there was some existing
implementation that had updatable insensitive cursors, but the working
group decided it wasn't sound and invented a separate half-way type for
it.
--
Peter Eisentraut peter_e(at)gmx(dot)net
From | Date | Subject | |
---|---|---|---|
Next Message | ohp | 2003-03-31 18:02:08 | What's wrong |
Previous Message | John Liu | 2003-03-31 17:47:36 | Re: 7.3.2 make failed on AIX4.3 using native c compiler |