changeset 575:4c84d908e891 find-refactoring

fix statistics in read-only
author Alain Mazy <am@orthanc.team>
date Mon, 30 Sep 2024 18:02:36 +0200
parents 58fce5aebb31
children b0533b703c2c e99ca3508757
files PostgreSQL/Plugins/SQL/PrepareIndex.sql
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/PostgreSQL/Plugins/SQL/PrepareIndex.sql	Fri Sep 27 18:49:10 2024 +0200
+++ b/PostgreSQL/Plugins/SQL/PrepareIndex.sql	Mon Sep 30 18:02:36 2024 +0200
@@ -558,11 +558,11 @@
     
 BEGIN
 
-    SELECT VALUE from GlobalIntegers
+    SELECT VALUE FROM GlobalIntegers
     INTO current_value
     WHERE key = statistics_key;
 
-    SELECT sum(value) + current_value FROM GlobalIntegersChanges
+    SELECT COALESCE(SUM(value), 0) + current_value FROM GlobalIntegersChanges
     INTO accumulated_value
     WHERE key = statistics_key;