ArchiveEntry optional arguments refactoring

From: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: ArchiveEntry optional arguments refactoring
Date: 2019-01-16 12:16:40
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers


During the discussion in [1] an idea about refactoring ArchiveEntry was
suggested. The reason is that currently this function has significant number of
arguments that are "optional", and every change that has to deal with it
introduces a lot of useless diffs. In the thread, mentioned above, such an
example is tracking current table access method, and I guess "Remove WITH OIDS"
commit 578b229718e is also similar.

Proposed idea is to refactor out all/optional arguments into a separate data
structure, so that adding/removing a new argument wouldn't change that much of
unrelated code. Then for every invocation of ArchiveEntry this structure needs
to be prepared before the call, or as Andres suggested:

ArchiveEntry((ArchiveArgs){.tablespace = 3,
.dumpFn = somefunc,

Another suggestion from Amit is to have an ArchiveEntry() function with limited
number of parameters, and an ArchiveEntryEx() with those extra parameters which
are not needed in usual cases.

I want to prepare a patch for that, and I'm inclined to go with the first
option, but since there are two solutions to choose from, I would love to hear
more opinion about this topic. Any pros/cons we don't see yet?



Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Dolgov 2019-01-16 12:18:06 Re: ArchiveEntry optional arguments refactoring
Previous Message Arthur Zakirov 2019-01-16 11:42:44 Re: [PROPOSAL] Shared Ispell dictionaries