[PATCH] Unify duplicate-option handling across utility commands
[PATCH] Unify duplicate-option handling across utility commands
Hi,
I worked on unifying how the utility commands (VACUUM, ANALYZE, EXPLAIN,
CHECKPOINT, REPACK) handle duplicate options. It came up in one of my
patches here [1].
Based on that, I'm leaning towards last-wins rather than erroring on
duplicate options. It matches what REPACK/VACUUM/EXPLAIN already do, and
REPACK was recently fixed in-tree to be last-wins. But let me know your feedback,
I worked on unifying how the utility commands (VACUUM, ANALYZE, EXPLAIN,
CHECKPOINT, REPACK) handle duplicate options. It came up in one of my
patches here [1].
Based on that, I'm leaning towards last-wins rather than erroring on
duplicate options. It matches what REPACK/VACUUM/EXPLAIN already do, and
REPACK was recently fixed in-tree to be last-wins. But let me know your feedback,
since COPY and WAIT FOR follow the error mechanism:
1/ is it better to have the error everywhere instead? Or
2/ go with the attached rough draft of the patch, which adds a centralized helper that
1/ is it better to have the error everywhere instead? Or
2/ go with the attached rough draft of the patch, which adds a centralized helper that
collapses duplicates to last-wins and has each command called once?
[1] https://www.postgresql.org/message-id/CAA-aLv57ymRoDJ%2B2UnHCE7WDB_FH5pW9%2BbFX7z5wEegudPrdRQ%40mail.gmail.com
Regards,
Baji Shaik
[1] https://www.postgresql.org/message-id/CAA-aLv57ymRoDJ%2B2UnHCE7WDB_FH5pW9%2BbFX7z5wEegudPrdRQ%40mail.gmail.com
Regards,
Baji Shaik
Re: [PATCH] Unify duplicate-option handling across utility commands
От:
Álvaro Herrera <alvherre@kurilemu.de>
Дата:
On 2026-Oct-07, Baji Shaik wrote: > Based on that, I'm leaning towards last-wins rather than erroring on > duplicate options. It matches what REPACK/VACUUM/EXPLAIN already do, and > REPACK was recently fixed in-tree to be last-wins. Oh, it was? I don't remember that -- where is that? I don't think last-wins is our norm, or is it? -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "In fact, the basic problem with Perl 5's subroutines is that they're not crufty enough, so the cruft leaks out into user-defined code instead, by the Conservation of Cruft Principle." (Larry Wall, Apocalypse 6)
Re: [PATCH] Unify duplicate-option handling across utility commands
От:
Baji Shaik <baji.pgdev@gmail.com>
Дата:
On Wed, Oct 7, 2026 at 1:31 PM Álvaro Herrera <alvherre@kurilemu.de> wrote:
On 2026-Oct-07, Baji Shaik wrote:
Oh, it was? I don't remember that -- where is that?
made REPACK honor the last value when an option is repeated.
I don't think last-wins is our norm, or is it?
via errorConflictingDefElem() (COPY, WAIT FOR, CREATE/ALTER ROLE and
SUBSCRIPTION, CREATE DATABASE, etc.).
my thought process was like these are maintenance-style commands
(VACUUM, ANALYZE, EXPLAIN, CHECKPOINT, REPACK) and are last-wins, so
I went in that direction thinking of them as one group that behaves the same way.
So if the goal is to unify across the board, I'm happy to go with
rejection instead and make the maintenance commands reject duplicates too,
which matches the majority. I can redo the patch that way.
Thanks,
Baji Shaik.