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
pull/6909/head^2
Jelte Fennema 2023-05-09 16:55:56 +02:00 committed by GitHub
parent e3c6b8a10e
commit 07b8cd2634
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -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);
}
}