[PATCH] Fix compilation of nodeMergejoin.c with EXEC_MERGEJOINDEBUG

Started by Tatsuya Kawata3 months ago7 messageshackers
Jump to latest
#1Tatsuya Kawata
kawatatatsuya0913@gmail.com

Hi,

nodeMergejoin.c does not compile when EXEC_MERGEJOINDEBUG is defined:

In file included from src/backend/executor/nodeMergejoin.c:96:
src/backend/executor/nodeMergejoin.c: In function 'ExecMergeTupleDumpOuter':
src/include/executor/execdebug.h:107:57: warning: implicit declaration of
function 'debugtup'; did you mean 'MJ_debugtup'?
[-Wimplicit-function-declaration]
107 | #define MJ_debugtup(slot)
debugtup(slot, NULL)
| ^~~~~~~~
src/backend/executor/nodeMergejoin.c:551:17: note: in expansion of macro
'MJ_debugtup'
551 | MJ_debugtup(outerSlot);
| ^~~~~~~~~~~

debugtup() is declared in access/printtup.h, but execdebug.h includes
only executor/executor.h and nodes/print.h. The attached one-line patch
adds it.

As for back-patching, I think master alone is enough since this is
debug-only code, but I don't have a strong opinion.

Regards,
Tatsuya Kawata

Attachments:

t253429_1
v1-0001-Fix-compilation-of-nodeMergejoin.c-with-EXEC_MERG.patchapplication/octet-stream; name=v1-0001-Fix-compilation-of-nodeMergejoin.c-with-EXEC_MERG.patchDownload+1-1
#2Michael Paquier
michael@paquier.xyz
In reply to: Tatsuya Kawata (#1)
Re: [PATCH] Fix compilation of nodeMergejoin.c with EXEC_MERGEJOINDEBUG

On Sun, Aug 16, 2026 at 03:27:43PM +0900, Tatsuya Kawata wrote:

debugtup() is declared in access/printtup.h, but execdebug.h includes
only executor/executor.h and nodes/print.h. The attached one-line patch
adds it.

As for back-patching, I think master alone is enough since this is
debug-only code, but I don't have a strong opinion.

The oldest version of the tree I have around is v11, and if I enable
EXEC_MERGEJOINDEBUG I get the exact same failure. This means that
this has been unnoticed for at least 10 years.

So question time: Is this debugging code still relevant and wouldn't
it be better to just remove it? It looks pretty clear to me that
nobody is using this #define at all, or this failure would have been
noticed a long time ago.

Note that an all-time search of EXEC_MERGEJOINDEBUG on pgsql-hackers
and pgsql-bugs points only at this thread.
--
Michael

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Michael Paquier (#2)
Re: [PATCH] Fix compilation of nodeMergejoin.c with EXEC_MERGEJOINDEBUG

Michael Paquier <michael@paquier.xyz> writes:

So question time: Is this debugging code still relevant and wouldn't
it be better to just remove it?

+1. I'd be inclined to think about removing execdebug.h altogether.
If this style of debug support were really useful, it would have
migrated into more than three kinds of executor node by now.

regards, tom lane

#4Michael Paquier
michael@paquier.xyz
In reply to: Tom Lane (#3)
Re: [PATCH] Fix compilation of nodeMergejoin.c with EXEC_MERGEJOINDEBUG

On Sun, Aug 16, 2026 at 10:26:33AM -0400, Tom Lane wrote:

+1. I'd be inclined to think about removing execdebug.h altogether.
If this style of debug support were really useful, it would have
migrated into more than three kinds of executor node by now.

Please find attached a patch to clean up execdebug.h and its APIs.
How does that look?

Here are the cleanup numbers:
6 files changed, 4 insertions(+), 348 deletions(-)
--
Michael

Attachments:

t253429_4
0001-Remove-execdebug.h-and-its-infrastructure.patchtext/plain; charset=us-asciiDownload+4-349
#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Michael Paquier (#4)
Re: [PATCH] Fix compilation of nodeMergejoin.c with EXEC_MERGEJOINDEBUG

Michael Paquier <michael@paquier.xyz> writes:

On Sun, Aug 16, 2026 at 10:26:33AM -0400, Tom Lane wrote:

+1. I'd be inclined to think about removing execdebug.h altogether.
If this style of debug support were really useful, it would have
migrated into more than three kinds of executor node by now.

Please find attached a patch to clean up execdebug.h and its APIs.
How does that look?

LGTM. There are a few places in the calling files where I might've
removed more blank lines than you did, or removed no-longer-necessary
brace pairs, but that's all a matter of taste.

regards, tom lane

#6Tatsuya Kawata
kawatatatsuya0913@gmail.com
In reply to: Tom Lane (#5)
Re: [PATCH] Fix compilation of nodeMergejoin.c with EXEC_MERGEJOINDEBUG

Hi,

Sorry for the late reply, and thanks for taking this over!

So question time: Is this debugging code still relevant and wouldn't
it be better to just remove it? It looks pretty clear to me that
nobody is using this #define at all, or this failure would have been
noticed a long time ago.

Removing the whole thing sounds good to me.
I agree that none of this infrastructure is used by anybody these days.

Please find attached a patch to clean up execdebug.h and its APIs.
How does that look?

I have checked the patch on my side: the tree builds cleanly, make
check passes, and I could not find any remaining references to
execdebug.h or to the macros it used to define.
LGTM.

Regards,
Tatsuya Kawata

#7Michael Paquier
michael@paquier.xyz
In reply to: Tatsuya Kawata (#6)
Re: [PATCH] Fix compilation of nodeMergejoin.c with EXEC_MERGEJOINDEBUG

On Sat, Aug 22, 2026 at 09:58:37AM +0900, Tatsuya Kawata wrote:

I have checked the patch on my side: the tree builds cleanly, make
check passes, and I could not find any remaining references to
execdebug.h or to the macros it used to define.
LGTM.

Thanks for the reviews. Removed a couple of useless brackets, as
mentioned, and applied.
--
Michael