Re: Fixes inconsistent behavior in vacuum when it processes multiple relations

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Andres Freund <andres(at)anarazel(dot)de>, shihao zhong <zhong950419(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fixes inconsistent behavior in vacuum when it processes multiple relations
Date: 2026-03-27 18:58:39
Message-ID: acbTX__yMnHSMIw4@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 27, 2026 at 08:03:30AM +0900, Michael Paquier wrote:
> Still, I slightly prefer your v2, where the interface of vacuum_rel()
> is leaner with all the other ones. It comes at the cost of copying
> the input parameters into a temporary "copy" of VacuumParams, but I
> see the fact of marking the input "params" with a const as more
> valuable in the long-run, with less temptation to manipulate it
> directly especially it is not not marked with a const. One small
> worry with v3 is that people like copy-pasting code around, and I
> suspect that v2 could discourage better the patterns that 2252fcd4276c
> has tried to improve and that 661643dedad9 had to fix.

I disagree with you here. By passing the struct by-value, we are avoiding
scribbles on the original one without an explicit memcpy and without a big
comment warning folks to only use the copy (which seems like it'd be easy
to miss). I think using a const pointer in most places makes sense, but
not if we need to immediately copy the contents to a local variable anyway.

--
nathan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message SATYANARAYANA NARLAPURAM 2026-03-27 19:03:46 Re: Skipping schema changes in publication
Previous Message Tom Lane 2026-03-27 18:56:18 Re: add function argument name to substring and substr