From 9ac5e0256d8df9012a3eba9f0eec7c56c592361d Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Wed, 7 Jan 2026 10:22:03 +0100 Subject: [PATCH] make sure array_merge() never returns null --- lib-sql/functions/utils.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib-sql/functions/utils.sql b/lib-sql/functions/utils.sql index 3baf8240..30a2aa8a 100644 --- a/lib-sql/functions/utils.sql +++ b/lib-sql/functions/utils.sql @@ -2,7 +2,7 @@ -- -- This file is part of Nominatim. (https://nominatim.org) -- --- Copyright (C) 2025 by the Nominatim developer community. +-- Copyright (C) 2026 by the Nominatim developer community. -- For a full list of authors see the git log. -- Assorted helper functions for the triggers. @@ -46,13 +46,13 @@ DECLARE r INTEGER[]; BEGIN IF array_upper(a, 1) IS NULL THEN - RETURN b; + RETURN COALESCE(b, '{}'::INTEGER[]); END IF; IF array_upper(b, 1) IS NULL THEN - RETURN a; + RETURN COALESCE(a, '{}'::INTEGER[]); END IF; r := a; - FOR i IN 1..array_upper(b, 1) LOOP + FOR i IN 1..array_upper(b, 1) LOOP IF NOT (ARRAY[b[i]] <@ r) THEN r := r || b[i]; END IF;