[PATCH] Fix compilation of nodeMergejoin.c with EXEC_MERGEJOINDEBUG

Started by Tatsuya Kawata8 days ago7 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

This thread has been committed, so CI has stopped here. Anything below is the last result it produced.

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t253429
psql -h localhost -U postgres

Built from patchset v4 (message #4), August 22, 2026 at 07:03 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t253429_4 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t253429_4 && git checkout t253429_4

Patchset v4 (message #4) is on t253429_4

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