Skip site navigation (1) Skip section navigation (2)

RE: [HACKERS] Re: possible row locking bug in 7.0.3 & 7.1

From: "Mikheev, Vadim" <vmikheev(at)SECTORBASE(dot)COM>
To: "'Hiroshi Inoue'" <Inoue(at)tpf(dot)co(dot)jp>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Philip Warner <pjw(at)rhyme(dot)com(dot)au>, pgsql-sql(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: RE: [HACKERS] Re: possible row locking bug in 7.0.3 & 7.1
Date: 2001-03-28 17:58:43
Message-ID: 8F4C99C66D04D4118F580090272A7A234D3356@sectorbase1.sectorbase.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-sql
> > I don't think that we dare try to make any basic changes in 
> > MVCC for 7.1 at this late hour, so Forest is going to have
> > to live with that answer for awhile. But I would like to see
> > a cleaner answer in future releases.
> 
> Is it the MVCC's restriction that each query inside a function
> must use the same snapshot ?

No. MVCC restricts what is visible to query itself. Current
function' behaviour is like Oracle' one.
Strictly speaking queries inside function don't use the same
snapshot - they see changes made by other queries of this
function. Should we allow them see changes made by other
transactions? I'm not sure. Maybe by special means like
CREATE SNAPSHOT S;
SELECT FROM foo WITH SNAPSHOT S;
?

For this particular case - concurrent UPDATE then
UPDATE/DELETE + SELECT - there is simple solution: meeting
tuple updated by concurrent *committed* transaction
SELECT (in READ COMMITTED mode) should look in newer tuple
versions. If some of newer tuples is invalidated (updated/deleted)
by *this* transaction and this invalidation is *visible*
to SELECT (older CommandId) then old tuple version must not
be returned (newer tuple version will be returned of course).
Reported problem is caused by bug (only one tuple version must be
returned by SELECT) and this is way to fix it.

But note that for the case of concurrent DELETE then
INSERT + SELECT two tuples will be returned anyway and
I don't think that this is bug.

> > As I've opined before, the whole EvalPlanQual mechanism
> > strikes me as essentially bogus in any case...
> 
> How would you change it ? UPDATE/SELECT FOR UPDATE have to
> SELECT/UPDATE the latest tuples. I don't think of any simple
> way for 'SELECT FOR UPDATE' to have the same visibility as
> simple SELECT.

Yes, I also don't understand what's wrong with EvalPlanQual.

Vadim

pgsql-hackers by date

Next:From: Mikheev, VadimDate: 2001-03-28 18:10:02
Subject: RE: Re: [SQL] possible row locking bug in 7.0.3 & 7.1
Previous:From: Thomas SwanDate: 2001-03-28 16:55:35
Subject: Re: Feature Request: ALTER FUNCTION (or something like that)

pgsql-sql by date

Next:From: Douglas BruntonDate: 2001-03-28 18:24:11
Subject: Oracle -> Postgresql migration
Previous:From: Tom LaneDate: 2001-03-28 16:17:55
Subject: Re: DELETE FROM fails with error

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group