0004-fixup-Row-filter-for-logical-replication.patch

text/plain

Filename: 0004-fixup-Row-filter-for-logical-replication.patch
Type: text/plain
Part: 3
Message: Re: row filtering for logical replication

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch 0004
Subject: fixup! Row filter for logical replication
File+
src/backend/replication/pgoutput/pgoutput.c 5 11
From b82e7b05bb3fd73bede39f480c31d657fe410e41 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Thu, 25 Mar 2021 12:02:48 +0100
Subject: [PATCH 4/6] fixup! Row filter for logical replication

elog arguments are not evaluated unless the message level is
interesting, so the previous workaround is unnecessary.
---
 src/backend/replication/pgoutput/pgoutput.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c
index 593a8c96c8..00ad8f001f 100644
--- a/src/backend/replication/pgoutput/pgoutput.c
+++ b/src/backend/replication/pgoutput/pgoutput.c
@@ -603,17 +603,11 @@ pgoutput_row_filter(Relation relation, HeapTuple oldtuple, HeapTuple newtuple, L
 		/* Evaluates row filter */
 		result = pgoutput_row_filter_exec_expr(exprstate, ecxt);
 
-		if (message_level_is_interesting(DEBUG3))
-		{
-			char	   *s = NULL;
-
-			s = TextDatumGetCString(DirectFunctionCall2(pg_get_expr, CStringGetTextDatum(nodeToString(rfnode)), ObjectIdGetDatum(relation->rd_id)));
-			if (result)
-				elog(DEBUG3, "row filter \"%s\" matched", s);
-			else
-				elog(DEBUG3, "row filter \"%s\" not matched", s);
-			pfree(s);
-		}
+		elog(DEBUG3, "row filter \"%s\" %smatched",
+			 TextDatumGetCString(DirectFunctionCall2(pg_get_expr,
+													 CStringGetTextDatum(nodeToString(rfnode)),
+													 ObjectIdGetDatum(relation->rd_id))),
+			 result ? "" : " not");
 
 		/* If the tuple does not match one of the row filters, bail out */
 		if (!result)
-- 
2.30.2