Skip to content

Commit 080c758

Browse files
Zhang Wenchaozhangwenchao-123
authored andcommitted
Address PR review: restore Assert and convert nvalues check to runtime
- Add back Assert(valuetype == FLOAT8OID) as defensive check after the type guard (per gfphoenix78 review) - Replace Assert(nvalues == 1) with runtime validity check to avoid assertion failure in non-debug builds (per yjhjstz review) Authored-by: Zhang Wenchao <zhangwenchao@apache.org>
1 parent 97f4ea5 commit 080c758

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/backend/commands/analyzeutils.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,13 @@ getNdvBySegHeapTuple(AttStatsSlot * *ndvbsSlots, HeapTuple *heaptupleStats, floa
777777
continue;
778778
}
779779

780-
Assert(ndvbsSlots[i]->nvalues == 1);
780+
Assert(ndvbsSlots[i]->valuetype == FLOAT8OID);
781+
782+
if (ndvbsSlots[i]->nvalues != 1)
783+
{
784+
valid = false;
785+
break;
786+
}
781787

782788
/* Non-empty partition with zero NDV is suspicious */
783789
if (relTuples[i] > 0 && DatumGetFloat8(ndvbsSlots[i]->values[0]) == 0)

0 commit comments

Comments
 (0)