diff options
Diffstat (limited to 'src/backend/optimizer/path/indxpath.c')
-rw-r--r-- | src/backend/optimizer/path/indxpath.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c index da4d7c52845..49ab3666b93 100644 --- a/src/backend/optimizer/path/indxpath.c +++ b/src/backend/optimizer/path/indxpath.c @@ -1886,7 +1886,7 @@ get_loop_count(PlannerInfo *root, Index cur_relid, Relids outer_relids) if (outer_relids == NULL) return 1.0; - result = 1.0; + result = 0.0; outer_relid = -1; while ((outer_relid = bms_next_member(outer_relids, outer_relid)) >= 0) { @@ -1915,10 +1915,11 @@ get_loop_count(PlannerInfo *root, Index cur_relid, Relids outer_relids) outer_rel->rows); /* Remember smallest row count estimate among the outer rels */ - if (result == 1.0 || result > rowcount) + if (result == 0.0 || result > rowcount) result = rowcount; } - return result; + /* Return 1.0 if we found no valid relations (shouldn't happen) */ + return (result > 0.0) ? result : 1.0; } /* |