Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2dcd92e

Browse files
committed
Ensure acquire_inherited_sample_rows sets its output parameters.
The totalrows/totaldeadrows outputs were left uninitialized in caseswhere we find no analyzable child tables of a partitioned table. Thiscould lead to setting the partitioned table's pg_class.reltuples valueto garbage. It's not clear that that would have any very bad effectsin practice, but fix it anyway because it's making valgrind unhappy.Reported and diagnosed by Alexander Lakhin (bug #17880).Discussion:https://postgr.es/m/17880-9282037c923d856e@postgresql.org
1 parent2110162 commit2dcd92e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎src/backend/commands/analyze.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,6 +1409,10 @@ acquire_inherited_sample_rows(Relation onerel, int elevel,
14091409
ListCell*lc;
14101410
boolhas_child;
14111411

1412+
/* Initialize output parameters to zero now, in case we exit early */
1413+
*totalrows=0;
1414+
*totaldeadrows=0;
1415+
14121416
/*
14131417
* Find all members of inheritance set. We only need AccessShareLock on
14141418
* the children.
@@ -1542,8 +1546,6 @@ acquire_inherited_sample_rows(Relation onerel, int elevel,
15421546
pgstat_progress_update_param(PROGRESS_ANALYZE_CHILD_TABLES_TOTAL,
15431547
nrels);
15441548
numrows=0;
1545-
*totalrows=0;
1546-
*totaldeadrows=0;
15471549
for (i=0;i<nrels;i++)
15481550
{
15491551
Relationchildrel=rels[i];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp