Re: ArchiveEntry optional arguments refactoring

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, 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:36:13
Message-ID: 20190123173613.7jgxkiwxa5zzm2ww@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-01-23 12:32:06 -0500, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > On 2019-01-23 13:58:07 -0300, Alvaro Herrera wrote:
> >> 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.
>
> That looks fairly reasonable from here, but I'd suggest
> ARCHIVE_OPTS rather than ARCHIVE_ARGS.

WFM. Seems quite possible that we'd grow a few more of these over time,
so establishing some common naming seems good.

Btw, do you have an opionion on keeping catId / dumpId outside/inside
the argument struct?

> Can we omit the initial dots if we use a wrapper macro? Would it be
> a good idea to do so (I'm not really sure)?

Not easily, if at all, I think. We'd have to do a fair bit of weird
macro magic (and then still end up with limitations) to "process" each
argument individually. And even if it were easy, I don't think it's
particularly advantageous.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2019-01-23 18:17:26 Re: [HACKERS] REINDEX CONCURRENTLY 2.0
Previous Message Tom Lane 2019-01-23 17:32:06 Re: ArchiveEntry optional arguments refactoring