From 945b366ef523bfe42c815c7d6c5505da46e61e1a Mon Sep 17 00:00:00 2001 From: dinaatmiro Date: Thu, 8 Jan 2026 17:08:04 +0000 Subject: [PATCH] fix(recency): handle empty tables returning NULL When a table is empty, MAX(field) returns NULL. The comparison NULL < threshold evaluates to NULL (not TRUE), causing the WHERE clause to filter out the row and incorrectly pass the test. This fix adds 'OR most_recent IS NULL' to properly fail the test when a table has no data within the recency window, including when the table is completely empty. --- macros/generic_tests/recency.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/generic_tests/recency.sql b/macros/generic_tests/recency.sql index 7fe2cafdf..8ffd3c91c 100644 --- a/macros/generic_tests/recency.sql +++ b/macros/generic_tests/recency.sql @@ -37,5 +37,6 @@ select from recency where most_recent < {{ threshold }} + or most_recent is null {% endmacro %}