On 29.01.22 15:30, Bharath Rupireddy wrote:
> While working on another pg_control patch, I observed that the
> pg_controldata output fields such as "Latest checkpoint's
> TimeLineID:", "Latest checkpoint's NextOID:'' and so on, are being
> used in pg_resetwal.c, pg_controldata.c and pg_upgrade/controldata.c.
The duplication between pg_resetwal and pg_controldata could probably be
handled by refactoring the code so that only one place is responsible
for printing it. The usages in pg_upgrade are probably best guarded by
tests that ensure that any changes anywhere else don't break things.
Using macros like you suggest only protects against one kind of change:
changing the wording of a line. But it doesn't protect for example
against a line being removed from the output.
While I'm sympathetic to the issue you describe, the proposed solution
introduces a significant amount of ugliness for a problem that is really
quite rare.