pgsql: Fix some oversights in commit 2455ab488.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix some oversights in commit 2455ab488.
Date: 2019-03-14 22:36:43
Message-ID: E1h4Yxv-0003X9-PY@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix some oversights in commit 2455ab488.

The idea was to generate all the junk in a destroyable subcontext rather
than leaking it in the caller's context, but partition_bounds_create was
still being called in the caller's context, allowing plenty of scope for
leakage. Also, get_rel_relkind() was still being called in the rel's
rd_pdcxt, creating a risk of session-lifespan memory wastage.

Simplify the logic a bit while at it. Also, reduce rd_pdcxt to
ALLOCSET_SMALL_SIZES, since it seems likely to not usually be big.

Probably something like this needs to be back-patched into v11,
but for now let's get some buildfarm testing on this.

Discussion: https://postgr.es/m/15943.1552601288@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/de570047993bd5fd65ad2bdf6b0acf5b8939bcb3

Modified Files
--------------
src/backend/partitioning/partdesc.c | 72 +++++++++++++++++--------------------
1 file changed, 33 insertions(+), 39 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2019-03-14 23:27:37 pgsql: Reorder identity regression test
Previous Message Peter Eisentraut 2019-03-14 21:44:33 pgsql: Improve code comment