From f4cbcf77ddcfe8d66531d466744a9e5a457e9966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Skrz=C4=99tnicki?= Date: Fri, 14 Jun 2024 11:34:12 +0200 Subject: [PATCH] Properly coalesce null table list into empty array. --- lib/srv/db/postgres/sql/update-permissions.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/srv/db/postgres/sql/update-permissions.sql b/lib/srv/db/postgres/sql/update-permissions.sql index 50a50e32cd62d..16a564146d13d 100644 --- a/lib/srv/db/postgres/sql/update-permissions.sql +++ b/lib/srv/db/postgres/sql/update-permissions.sql @@ -7,8 +7,7 @@ DECLARE diff_count_1 INTEGER; diff_count_2 INTEGER; BEGIN - - grant_data = COALESCE(permissions_->'tables', '[]'::JSONB); + grant_data = COALESCE(NULLIF(permissions_->'tables', 'null'), '[]'::JSONB); -- If the user has active connections to current database, verify that permissions haven't changed. IF EXISTS (SELECT usename FROM pg_stat_activity WHERE usename = username AND datname = current_database()) THEN