Re: Replace pg_controldata output fields with macros for better code manageability - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Replace pg_controldata output fields with macros for better code manageability
Date
Msg-id d0b0fa85-4fe9-7d0c-c74c-18141bc8aab5@enterprisedb.com
Whole thread Raw
In response to Replace pg_controldata output fields with macros for better code manageability  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
List pgsql-hackers
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.




pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: pg_receivewal - couple of improvements
Next
From: Peter Eisentraut
Date:
Subject: Re: psql - add SHOW_ALL_RESULTS option