Re: BUG #17880: Uninitialised value used when analyzing a table with an inheritance tree containing no children

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: exclusion(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17880: Uninitialised value used when analyzing a table with an inheritance tree containing no children
Date: 2023-03-31 13:40:35
Message-ID: 435880.1680270035@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> As I can see, this error is explained by the fact that
> acquire_inherited_sample_rows() can exit before setting
> *totalrows = 0;
> *totaldeadrows = 0;
> so variables declared in do_analyze_rel() as
> double totalrows,
> totaldeadrows;
> stay uninitialised and totalrows passed to vac_update_relstats() where it
> triggers the valgrind complaint.

Good catch!

> On a quick glance, the peer functions acquire_sample_rows(),
> postgresAcquireSampleRowsFunc(), file_acquire_sample_rows() can't exit
> without setting totalrows/totaldeadrows, so maybe
> acquire_inherited_sample_rows() deserves fixing (or maybe those variables
> can be initialized in do_analyze_rel()).

Yeah, I'd put the blame on acquire_inherited_sample_rows. Its head
comment says it has the same API as acquire_sample_rows, and that
one's comment says that totalrows/totaldeadrows are always set.
Will fix, thanks.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message José María Terry Jiménez 2023-03-31 22:09:10 Re: BUG #17881: Dependency error in Barman 3.5 **SOLVED**
Previous Message David G. Johnston 2023-03-31 13:40:29 BUG #17881: Dependency error in Barman 3.5