Re: updateable cursors & visibility - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: updateable cursors & visibility
Date
Msg-id 200303281612.h2SGCOi07483@candle.pha.pa.us
Whole thread Raw
In response to Re: updateable cursors & visibility  (Hiroshi Inoue <Inoue@tpf.co.jp>)
Responses Re: updateable cursors & visibility  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
List pgsql-hackers
Hiroshi Inoue wrote:
> > > I don't understand what you two are discussing.
> > > What's is SENSITIVE, INSENSITIVE or ASESNSITIVE ?
> > 
> > In SQL99 standard, I see:
> > 
> >          -  If the cursor is insensitive, then significant changes are not
> >             visible.
> > 
> >          -  If the cursor is sensitive, then significant changes are
> >             visible.
> > 
> >          -  If the cursor is asensitive, then the visibility of significant
> >             changes is implementation-dependent.
> 
> While a cursor is open, another application inserted a
> row which satisfies the condition to be contained in
> the cursor and committed. Then
> If the cursor is SENSITIVE, must it see the row ?

Right.

> If the cursor is INSENSITIVE, it mustn't see the row ?

Right.

What I don't understand is how the row would automatically appear in a
sensitive cursor.  If the cursor has an ORDER BY, and there are 100
rows, and I am on row 50, and someone inserts a row that is ordered just
before 50, is my current row now 51, and 50 is the new added row, and if
I do a MOVE -1, I see the most recently inserted row and not the row I
saw as 49 before.  Seems quite confusing.

Anyway, my idea is to have the existing cursor rows appear as updated to
the UPDATE, but to remain insensitive in the cursor itself.  We could
change that, but it would require us to somehow mark the cursor at
declare time to indicate that it will be used with WHERE CURRENT OF.

--  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 by date:

Previous
From: Larry Rosenman
Date:
Subject: Re: ECPG thread-safety
Next
From: Shridhar Daithankar
Date:
Subject: Re: ECPG thread-safety