From 7eec8f41a98930b571b05093bee974473be84454 Mon Sep 17 00:00:00 2001 From: Sven Klemm Date: Mon, 30 Oct 2023 19:27:53 +0100 Subject: [PATCH] Fix exception detail passing in compression_policy_execute In 2 instances of the exception handling _message and _detail were not properly set in compression_policy_execute leading to empty message and detail being reported. --- .unreleased/pr_6254 | 3 +++ sql/policy_internal.sql | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 .unreleased/pr_6254 diff --git a/.unreleased/pr_6254 b/.unreleased/pr_6254 new file mode 100644 index 00000000000..98d634dc65a --- /dev/null +++ b/.unreleased/pr_6254 @@ -0,0 +1,3 @@ +Fixes: #6254 Fix exception detail passing in compression_policy_execute + +Thanks: @fetchezar for reporting an issue with compression policy error messages diff --git a/sql/policy_internal.sql b/sql/policy_internal.sql index faf99c96e69..99a32d4a8f8 100644 --- a/sql/policy_internal.sql +++ b/sql/policy_internal.sql @@ -111,6 +111,9 @@ BEGIN BEGIN PERFORM @extschema@.decompress_chunk(chunk_rec.oid, if_compressed => true); EXCEPTION WHEN OTHERS THEN + GET STACKED DIAGNOSTICS + _message = MESSAGE_TEXT, + _detail = PG_EXCEPTION_DETAIL; RAISE WARNING 'decompressing chunk "%" failed when compression policy is executed', chunk_rec.oid::regclass::text USING DETAIL = format('Message: (%s), Detail: (%s).', _message, _detail), ERRCODE = sqlstate; @@ -122,6 +125,9 @@ BEGIN BEGIN PERFORM @extschema@.compress_chunk(chunk_rec.oid); EXCEPTION WHEN OTHERS THEN + GET STACKED DIAGNOSTICS + _message = MESSAGE_TEXT, + _detail = PG_EXCEPTION_DETAIL; RAISE WARNING 'compressing chunk "%" failed when compression policy is executed', chunk_rec.oid::regclass::text USING DETAIL = format('Message: (%s), Detail: (%s).', _message, _detail), ERRCODE = sqlstate;