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

Commit1b26bd4

Browse files
committed
Fix bug with view locking code.
LockViewRecurese() obtains view relation using heap_open() and passesit to get_view_query() to get view info. It immediately closes therelation then uses the returned view info by callingLockViewRecurse_walker(). Since get_view_query() returns a pointerwithin the relcache, the relcache should be kept untilLockViewRecurse_walker() returns. Otherwise the relation could pointto a garbage memory area.Fix is moving the heap_close() call after LockViewRecurse_walker().Problem reported by Tom Lane (buildfarm is unhappy, especially prionsince it enables -DRELCACHE_FORCE_RELEASE cpp flag), fix by me.
1 parent3e256e5 commit1b26bd4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎src/backend/commands/lockcmds.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ LockViewRecurse(Oid reloid, Oid root_reloid, LOCKMODE lockmode, bool nowait)
263263

264264
view=heap_open(reloid,NoLock);
265265
viewquery=get_view_query(view);
266-
heap_close(view,NoLock);
267266

268267
context.root_reloid=root_reloid;
269268
context.lockmode=lockmode;
@@ -272,6 +271,8 @@ LockViewRecurse(Oid reloid, Oid root_reloid, LOCKMODE lockmode, bool nowait)
272271
context.viewoid=reloid;
273272

274273
LockViewRecurse_walker((Node*)viewquery,&context);
274+
275+
heap_close(view,NoLock);
275276
}
276277

277278
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp