mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
Don't reject ROW_MARK_REFERENCE rowmarks for materialized views.
We should allow this so that matviews can be referenced in UPDATE/DELETE statements in READ COMMITTED isolation level. The requirement for that is that a re-fetch by TID will see the same row version the query saw earlier, which is true of matviews, so there's no reason for the restriction. Per bug #9398. Michael Paquier, after a suggestion by me
This commit is contained in:
@ -1102,14 +1102,15 @@ CheckValidRowMarkRel(Relation rel, RowMarkType markType)
|
||||
RelationGetRelationName(rel))));
|
||||
break;
|
||||
case RELKIND_MATVIEW:
|
||||
/* Should not get here */
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("cannot lock rows in materialized view \"%s\"",
|
||||
RelationGetRelationName(rel))));
|
||||
/* Allow referencing a matview, but not actual locking clauses */
|
||||
if (markType != ROW_MARK_REFERENCE)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("cannot lock rows in materialized view \"%s\"",
|
||||
RelationGetRelationName(rel))));
|
||||
break;
|
||||
case RELKIND_FOREIGN_TABLE:
|
||||
/* Should not get here */
|
||||
/* Should not get here; planner should have used ROW_MARK_COPY */
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("cannot lock rows in foreign table \"%s\"",
|
||||
|
Reference in New Issue
Block a user