From a243b29c9c4773bbcc248228456a9b5df03916b8 Mon Sep 17 00:00:00 2001 From: Erica Porter Date: Mon, 29 Apr 2024 16:26:02 +0100 Subject: [PATCH] Fix for checksum lookup (#139) * Fix string interpolation * Cast timestamp type --- lib/dfe/analytics/services/postgres_checksum_calculator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dfe/analytics/services/postgres_checksum_calculator.rb b/lib/dfe/analytics/services/postgres_checksum_calculator.rb index e09caf6f..594628d0 100644 --- a/lib/dfe/analytics/services/postgres_checksum_calculator.rb +++ b/lib/dfe/analytics/services/postgres_checksum_calculator.rb @@ -65,7 +65,7 @@ def build_select_and_order_clause(order_column, table_name_sanitized) def build_where_clause(order_column, table_name_sanitized, checksum_calculated_at_sanitized) return '' unless WHERE_CLAUSE_ORDER_COLUMNS.map(&:downcase).include?(order_column.downcase) - "WHERE DATE_TRUNC('milliseconds', #{table_name_sanitized}.#{order_column.downcase}) < DATE_TRUNC('milliseconds', '#{checksum_calculated_at_sanitized}')" + "WHERE DATE_TRUNC('milliseconds', #{table_name_sanitized}.#{order_column.downcase}) < DATE_TRUNC('milliseconds', #{checksum_calculated_at_sanitized}::timestamp)" end end end