From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: pgsql-bugs@postgresql.org
Cc: Kevin Grittner <kgrittn@ymail.com>
Subject: Re: BUG #9398: DELETE refering to a materialized view produces "cannot lock rows in materialized view" error
Date: Thu, 06 Mar 2014 11:43:44 -0500
Message-ID: <26899.1394124224@sss.pgh.pa.us> (raw)
In-Reply-To: <CAB7nPqRVKCAoezi3pKa407Z=VWqByYk3ecLngu8NStEPNLCc1A@mail.gmail.com>
References: <20140301095125.11734.87903@wrigleys.postgresql.org>
<CAB7nPqTW3=97=e4aVO4qOp85ZA1OX74DvBhKTag1CEOgMZESaw@mail.gmail.com>
<22267.1394063204@sss.pgh.pa.us>
<CAB7nPqRVKCAoezi3pKa407Z=VWqByYk3ecLngu8NStEPNLCc1A@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Michael Paquier <michael.paquier@gmail.com> writes:
> On Thu, Mar 6, 2014 at 8:46 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> 2. We could remove the error complaint in CheckValidRowMarkRel(),
>> allowing a matview row to be marked the same as a regular-table row.
>>
>> Since matview rows do in fact have TIDs and the same
>> visibility/vacuumability rules as regular-table rows (no?), I see no
>> reason that #2 wouldn't work, though I admit I've not actually tried it.
> After digging into #2, I finished with the attached patch that passes
> regression tests. The idea is simply to allow a matview to use
> ROW_MARK_REFERENCE and ROW_MARK_COPY when its rows are referenced. I
> added a regression test as well in the patch.
The ROW_MARK_COPY test is unnecessary since control will never reach this
function for that case. (If it did, most of the other case branches would
need to be checking it; checking only here is inconsistent.)
Also, after comparing this to the code in CheckValidResultRel, I wonder
why we aren't allowing SELECT FOR UPDATE in maintenance mode; that is,
shouldn't the test go like this:
if (markType != ROW_MARK_REFERENCE &&
!MatViewIncrementalMaintenanceIsEnabled())
However, that smells less like a bug fix and more like a feature addition,
so I'll leave it to Kevin to decide whether that's appropriate. In the
meantime, I committed the clear bug fix with some cosmetic adjustments.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, michael.paquier@gmail.com, kgrittn@ymail.com
Subject: Re: BUG #9398: DELETE refering to a materialized view produces "cannot lock rows in materialized view" error
In-Reply-To: <26899.1394124224@sss.pgh.pa.us>
References: <20140301095125.11734.87903@wrigleys.postgresql.org> <CAB7nPqTW3=97=e4aVO4qOp85ZA1OX74DvBhKTag1CEOgMZESaw@mail.gmail.com> <22267.1394063204@sss.pgh.pa.us> <CAB7nPqRVKCAoezi3pKa407Z=VWqByYk3ecLngu8NStEPNLCc1A@mail.gmail.com> <26899.1394124224@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox