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

Commitd65b665

Browse files
committed
Guard against zero vardata.rel->tuples in estimate_hash_bucketsize().
If the referenced rel was proven empty, we'd compute 0/0 here, whichresults in the function returning NaN. That's a bit more seriousthan the other zero-divide case. Still, it only seems to be possiblein HEAD, so no back-patch.Per report from Piotr Stefaniak. I looked through the rest of selfuncs.cand found no other likely trouble spots.
1 parentfa09f89 commitd65b665

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎src/backend/utils/adt/selfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3540,7 +3540,7 @@ estimate_hash_bucketsize(PlannerInfo *root, Node *hashkey, double nbuckets)
35403540
* XXX Possibly better way, but much more expensive: multiply by
35413541
* selectivity of rel's restriction clauses that mention the target Var.
35423542
*/
3543-
if (vardata.rel)
3543+
if (vardata.rel&&vardata.rel->tuples>0)
35443544
{
35453545
ndistinct *=vardata.rel->rows /vardata.rel->tuples;
35463546
ndistinct=clamp_row_est(ndistinct);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp