Unexpected message truncation in WaitForAllTransactionsToFinish

cca5507 <cca5507@qq.com>

From: cca5507 <cca5507@qq.com>
To: pgsql-hackers <pgsql-hackers@lists.postgresql.org>, daniel <daniel@yesql.se>
Date: 2026-06-05T08:30:51Z
Lists: pgsql-hackers
Hi,

In WaitForAllTransactionsToFinish():

```
		char		activity[64];
		int			rc;

		/* Oldest running xid is older than us, so wait */
		snprintf(activity,
				 sizeof(activity),
				 "Waiting for current transactions to finish (waiting for %u)",
				 waitforxid);
		pgstat_report_activity(STATE_RUNNING, activity);
```

The buffer is not big enough to hold the message if the 'waitforxid' is too big.

How about changing the message to this:

    "Waiting for transactions older than %u to finish"

--
Regards,
ChangAo Chen

Commits

  1. Reword activity message to avoid truncation