From cf407f639e71ce536969e104ef5d862d4ad6e575 Mon Sep 17 00:00:00 2001 From: "l.gualtieri" Date: Thu, 27 Feb 2025 18:35:26 +0100 Subject: [PATCH] fix #1064 --- core/vdbe/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/vdbe/mod.rs b/core/vdbe/mod.rs index 8187c1487..38b2092db 100644 --- a/core/vdbe/mod.rs +++ b/core/vdbe/mod.rs @@ -1722,6 +1722,7 @@ impl Program { *acc += col; } AggFunc::Count | AggFunc::Count0 => { + let col = state.registers[*col].clone(); if matches!(&state.registers[*acc_reg], OwnedValue::Null) { state.registers[*acc_reg] = OwnedValue::Agg(Box::new( AggContext::Count(OwnedValue::Integer(0)), @@ -1734,7 +1735,12 @@ impl Program { let AggContext::Count(count) = agg.borrow_mut() else { unreachable!(); }; - *count += 1; + + if (matches!(func, AggFunc::Count) && matches!(col, OwnedValue::Null)) + == false + { + *count += 1; + }; } AggFunc::Max => { let col = state.registers[*col].clone();