Re: BUG #15540: Use after release in ExecuteTruncateGuts

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: bianpan2016(at)163(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, Oleksandr Shulgin <oleksandr(dot)shulgin(at)zalando(dot)de>
Subject: Re: BUG #15540: Use after release in ExecuteTruncateGuts
Date: 2018-12-07 17:22:46
Message-ID: 20181207172246.3bdayfkuni6cbqks@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2018-Dec-07, Tom Lane wrote:

> =?utf-8?q?PG_Bug_reporting_form?= <noreply(at)postgresql(dot)org> writes:
> > The function ExecuteTruncateGuts drops the reference to rel via
> > relation_close when toast_relid is valid. However, after that, rel is passed
> > to pgstat_count_truncate. This may result in a use-after-release bug.
>
> ... and, even more to the point, the truncation stats count is incorrectly
> applied to the toast table not its parent.

Whoops! Thanks for fixing. You're right, we quite likely didn't
specifically test the case of there being a toast table. Amazing that
it took so long to find it.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2018-12-07 17:52:56 Re: BUG #15541: Use after release in PQprint
Previous Message Tom Lane 2018-12-07 16:09:05 Re: BUG #15540: Use after release in ExecuteTruncateGuts