commit 706748172cfe93b12f93c5dcdd33cc75a50b2db0
parent 5c1b580420727801588dd78d7cf4c6fed6d2b082
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Tue, 13 Jan 2026 08:21:36 +0900
handle empty arrays better
Diffstat:
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/backenddb/pg_insert_product.sql b/src/backenddb/pg_insert_product.sql
@@ -206,7 +206,7 @@ THEN
INTO i
FROM merchant_product_categories
WHERE product_serial=my_product_serial;
- IF i != array_length(ina_categories,1)
+ IF i != COALESCE(array_length(ina_categories,1),0)
THEN
out_conflict=TRUE;
out_no_cat=NULL;
diff --git a/src/backenddb/pg_statistics_helpers.sql b/src/backenddb/pg_statistics_helpers.sql
@@ -538,7 +538,7 @@ BEGIN
AND merchant_serial = my_instance_id
AND range = my_range;
END IF;
- IF (my_i < array_length(my_ranges,1))
+ IF (my_i < COALESCE(array_length(my_ranges,1),0))
THEN
-- carry over all events into the next slot
UPDATE merchant_statistic_interval_counter AS usic SET
@@ -728,7 +728,7 @@ BEGIN
AND curr = my_currency
AND range = my_range;
END IF;
- IF (my_i < array_length(my_ranges,1))
+ IF (my_i < COALESCE(array_length(my_ranges,1),0))
THEN
-- carry over all events into the next (larger) slot
UPDATE merchant_statistic_interval_amount AS msia SET