pgsql: Fix unsafe memory management in CloneRowTriggersToPartition().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix unsafe memory management in CloneRowTriggersToPartition().
Date: 2019-06-03 20:59:40
Message-ID: E1hXu3Q-00016H-Mf@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix unsafe memory management in CloneRowTriggersToPartition().

It's not really supported to call systable_getnext() in a different
memory context than systable_beginscan() was called in, and it's
*definitely* not safe to do so and then reset that context between
calls. I'm not very clear on how this code survived
CLOBBER_CACHE_ALWAYS testing ... but Alexander Lakhin found a case
that would crash it pretty reliably.

Per bug #15828. Fix, and backpatch to v11 where this code came in.

Discussion: https://postgr.es/m/15828-f6ddd7df4852f473@postgresql.org

Branch
------
master

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

Modified Files
--------------
src/backend/commands/tablecmds.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2019-06-03 22:06:21 pgsql: Fix contrib/auto_explain to not cause problems in parallel worke
Previous Message Peter Eisentraut 2019-06-03 19:39:13 pgsql: Update SQL conformance information about JSON path