From 07b8cd2634f2d1fa903f0635aa00733bb66cc6df Mon Sep 17 00:00:00 2001 From: Jelte Fennema Date: Tue, 9 May 2023 16:55:56 +0200 Subject: [PATCH] Forward to existing emit_log_hook in our log hook (#6877) DESCRIPTION: Forward to existing emit_log_hook in our log hook This makes us work better with other extensions installed in Postgres. Without this change we would overwrite their emit_log_hook, causing it to never be called. Fixes #6874 --- src/backend/distributed/shared_library_init.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/backend/distributed/shared_library_init.c b/src/backend/distributed/shared_library_init.c index e7fedd1d8..4e0f9d0de 100644 --- a/src/backend/distributed/shared_library_init.c +++ b/src/backend/distributed/shared_library_init.c @@ -213,6 +213,7 @@ static bool IsSuperuser(char *userName); static void AdjustDynamicLibraryPathForCdcDecoders(void); static ClientAuthentication_hook_type original_client_auth_hook = NULL; +static emit_log_hook_type original_emit_log_hook = NULL; /* *INDENT-OFF* */ /* GUC enum definitions */ @@ -458,6 +459,7 @@ _PG_init(void) ExecutorEnd_hook = CitusAttributeToEnd; /* register hook for error messages */ + original_emit_log_hook = emit_log_hook; emit_log_hook = multi_log_hook; @@ -698,6 +700,11 @@ multi_log_hook(ErrorData *edata) edata->message = pstrdup("canceling the transaction since it was " "involved in a distributed deadlock"); } + + if (original_emit_log_hook) + { + original_emit_log_hook(edata); + } }