Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f2U1kHK36774 for ; Thu, 29 Mar 2001 20:46:17 -0500 (EST) (envelope-from pgsql-sql-owner@postgresql.org) Received: from mailer.sectorbase.com (gate1.sectorbase.com [63.88.121.2]) by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2SHwlU42949 for ; Wed, 28 Mar 2001 12:58:47 -0500 (EST) (envelope-from vmikheev@SECTORBASE.COM) Received: (qmail 55476 invoked by uid 503); 28 Mar 2001 17:58:45 -0000 Received: from sectorbase1.sectorbase.com (192.168.254.1) by gate1.sectorbase.com with SMTP; 28 Mar 2001 17:58:45 -0000 Received: by sectorbase1.sectorbase.com with Internet Mail Service (5.5.2653.19) id ; Wed, 28 Mar 2001 09:58:44 -0800 Message-ID: <8F4C99C66D04D4118F580090272A7A234D3356@sectorbase1.sectorbase.com> From: "Mikheev, Vadim" To: "'Hiroshi Inoue'" , Tom Lane Cc: Philip Warner , pgsql-sql@postgresql.org, pgsql-hackers@postgresql.org Subject: RE: [HACKERS] Re: possible row locking bug in 7.0.3 & 7.1 Date: Wed, 28 Mar 2001 09:58:43 -0800 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-2022-jp" X-Archive-Number: 200103/621 X-Sequence-Number: 2292 > > 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