CREATE MATERIALIZED VIEW .. FOR UPDATE - Mailing list pgsql-hackers

From Alvaro Herrera
Subject CREATE MATERIALIZED VIEW .. FOR UPDATE
Date
Msg-id 20130802164633.GA16005@eldon.alvh.no-ip.org
Whole thread Raw
Responses Re: CREATE MATERIALIZED VIEW .. FOR UPDATE  (Kevin Grittner <kgrittn@ymail.com>)
Re: CREATE MATERIALIZED VIEW .. FOR UPDATE  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
Does the combination in $SUBJECT make sense?  It is currently allowed,
but of course the underlying locks only last while the creating
transaction is open, and they are reacquired during a refresh.

Somewhat related is that the error message they emit is a bit
nonstandard:

cannot lock rows in materialized view \"%s\"

After checking the reason for this, I noticed that it doesn't even match
what the code thinks it should (CheckValidRowMarkRel()):
    case RELKIND_MATVIEW:        /* Should not get here */        ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),                errmsg("cannot lock rows in materialized view \"%s\"",
         RelationGetRelationName(rel))));
 

apparently this function believes that the check should be applied
earlier, but it isn't.  I think we ought to either add a check to the
parser stage; *or* we should remove the "should not get here" comment.

I also propose we make these errors consistent with the wording of the
other related errors, i.e. "FOR UPDATE is not allowed with materialized
views", and of course change it for all the other cases in that
function.

Opinions?

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: "Kodamasimham Pridhvi (MT2012066)"
Date:
Subject: Need help to begin contribution in PostgreSQL Development - Specifically XML module
Next
From: Alvaro Herrera
Date:
Subject: Re: Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review])