Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitde0bea8

Browse files
committed
Lock relation used to generate fresh data for RMV.
Back-patch the 9.4-era commit2636ecf into 9.3, as that fixes a casewhere we open a relation while not holding any lock on it. It'sprobably mostly safe anyway, since no other session could touch thenewly-created table; but I think CheckTableNotInUse could be fooledif one tried.Per testing with a patch that complains if we open a relation withoutholding any lock on it. I don't plan to back-patch that patch, but weshould close the holes it identifies in all supported branches.Discussion:https://postgr.es/m/2038.1538335244@sss.pgh.pa.us
1 parent00d00b5 commitde0bea8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎src/backend/commands/matview.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include"executor/executor.h"
2727
#include"miscadmin.h"
2828
#include"rewrite/rewriteHandler.h"
29+
#include"storage/lmgr.h"
2930
#include"storage/smgr.h"
3031
#include"tcop/tcopprot.h"
3132
#include"utils/rel.h"
@@ -208,8 +209,13 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
208209

209210
tableSpace=matviewRel->rd_rel->reltablespace;
210211

211-
/* Create the transient table that will receive the regenerated data. */
212+
/*
213+
* Create the transient table that will receive the regenerated data. Lock
214+
* it against access by any other process until commit (by which time it
215+
* will be gone).
216+
*/
212217
OIDNewHeap=make_new_heap(matviewOid,tableSpace);
218+
LockRelationOid(OIDNewHeap,AccessExclusiveLock);
213219
dest=CreateTransientRelDestReceiver(OIDNewHeap);
214220

215221
/* Generate the data, if wanted. */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp