pgsql: Fix bug with view locking code.

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix bug with view locking code.
Date: 2018-03-31 00:29:11
Message-ID: E1f24ON-0004iv-Ic@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix bug with view locking code.

LockViewRecurese() obtains view relation using heap_open() and passes
it to get_view_query() to get view info. It immediately closes the
relation then uses the returned view info by calling
LockViewRecurse_walker(). Since get_view_query() returns a pointer
within the relcache, the relcache should be kept until
LockViewRecurse_walker() returns. Otherwise the relation could point
to a garbage memory area.

Fix is moving the heap_close() call after LockViewRecurse_walker().

Problem reported by Tom Lane (buildfarm is unhappy, especially prion
since it enables -DRELCACHE_FORCE_RELEASE cpp flag), fix by me.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1b26bd4089a388929c644ffea2832f3841c25969

Modified Files
--------------
src/backend/commands/lockcmds.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2018-03-31 00:38:00 pgsql: Remove PARTIAL_LINKING build mode.
Previous Message Andres Freund 2018-03-31 00:09:41 pgsql: Add SKIP_LOCKED option to RangeVarGetRelidExtended().