Re: BUG #15540: Use after release in ExecuteTruncateGuts - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: BUG #15540: Use after release in ExecuteTruncateGuts
Date
Msg-id 20181207172246.3bdayfkuni6cbqks@alvherre.pgsql
Whole thread Raw
In response to Re: BUG #15540: Use after release in ExecuteTruncateGuts  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On 2018-Dec-07, Tom Lane wrote:

> =?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.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


pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #15540: Use after release in ExecuteTruncateGuts
Next
From: Tom Lane
Date:
Subject: Re: BUG #15541: Use after release in PQprint