Re: ArchiveEntry optional arguments refactoring

From: Andres Freund <andres(at)anarazel(dot)de>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Amit Khandekar <amitdkhan(dot)pg(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ArchiveEntry optional arguments refactoring
Date: 2019-01-23 17:23:28
Message-ID: 20190123172328.b6trpdpcbzbq4unv@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-01-23 13:58:07 -0300, Alvaro Herrera wrote:
> Hello
>
> On 2019-Jan-23, Andres Freund wrote:
>
> > > All the arguments, except Archive, CatalogId and DumpId I've moved
> > > into the ArchiveOpts structure. Not all of them could be empty before, but
> > > anyway it seems better for consistency and readability. Some of the arguments
> > > had empty string as a default value, I haven't changed anything here yet
> > > (although this mixture of NULL and "" in ArchiveEntry looks a bit confusing).
> >
> > Probably worth changing at the same time, if we decide to go for it.
> >
> > To me this does look like it'd be more maintainable going forward.
>
> It does. How does pgindent behave with it?

It craps out:
Error(at)3649: Unbalanced parens
Warning(at)3657: Extra )

But that can be worked around with something like

te = ArchiveEntry(fout, tdinfo->dobj.catId, tdinfo->dobj.dumpId,
ARCHIVE_ARGS(.tag = tbinfo->dobj.name,
.namespace = tbinfo->dobj.namespace->dobj.name,
.owner = tbinfo->rolname,
.desc = "TABLE DATA",
.section = SECTION_DATA,
.copyStmt = copyStmt,
.deps = &(tbinfo->dobj.dumpId),
.nDeps = 1,
.dumpFn = dumpFn,
.dumpArg = tdinfo,
));
which looks mildly simpler too.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-01-23 17:25:09 Re: ArchiveEntry optional arguments refactoring
Previous Message Chapman Flack 2019-01-23 17:22:23 Re: ArchiveEntry optional arguments refactoring