Re: Remove unused function parameters, part 2: replication

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Remove unused function parameters, part 2: replication
Date: 2025-12-04 10:18:33
Message-ID: aTFf+ezCG8iut3jX@ip-10-97-1-34.eu-west-3.compute.internal
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, Dec 04, 2025 at 10:34:34AM +0100, Daniel Gustafsson wrote:
> > On 2 Dec 2025, at 15:28, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
>
> > That said I'm still skeptical that we need to provide a strong
> > justification (as the one above) to remove an unused parameter.
>
> If it breaks an existing published API thus causing extensions to fail to
> compile then IMHO that's a pretty strong argument against removing a parameter
> even if it's unused,

Yeah, that's why I did focus on static functions only.

> likewise if the change can be expected to cause backpatching conflicts for
> the coming five years.

Fair point about backpatching. That said, I did find examples of commits
removing unused parameters (see above). I'm trying to understand
when this kind of cleanup is considered acceptable vs. when the backpatching
cost outweighs the benefit. Any guidance would be helpful.

> For static functions at
> least it seems that compilers are fairly happy to remove the parameter in
> greater than -O0 levels (though I know that won't move the needle on one of
> your main drivers being readability).

Yeah, my motivation isn't execution efficiency.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2025-12-04 10:36:51 Re: POC: make mxidoff 64 bits
Previous Message Bertrand Drouvot 2025-12-04 10:04:37 Re: Use func(void) for functions with no parameters