Fix relcache reference leak in refresh_by_match_merge().

Tom Lane <tgl@sss.pgh.pa.us>

Commit: f7271c44278352516ec66b2de311952ce330b6d5
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2014-03-18T15:36:53Z
Releases: 9.4.0
Fix relcache reference leak in refresh_by_match_merge().

One path through the loop over indexes forgot to do index_close().  Rather
than adding a fourth call, restructure slightly so that there's only one.

In passing, get rid of an unnecessary syscache lookup: the pg_index struct
for the index is already available from its relcache entry.

Per report from YAMAMOTO Takashi, though this is a bit different from his
suggested patch.  This is new code in HEAD, so no need for back-patch.

Files

PathChange+/−
src/backend/commands/matview.c modified +13 −28