pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Amit Khandekar <amitdkhan.pg@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: ArchiveEntry optional arguments refactoring
Date: Wed, 23 Jan 2019 09:23:28 -0800
Message-ID: <20190123172328.b6trpdpcbzbq4unv@alap3.anarazel.de> (raw)
In-Reply-To: <201901231658.fls2whf2xypv@alvherre.pgsql>
References: <20190123164734.cnt7ho34ygwsav7z@alap3.anarazel.de>
	<201901231658.fls2whf2xypv@alvherre.pgsql>

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@3649: Unbalanced parens
Warning@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




view thread (28+ messages)  latest in thread

Message-ID: <20190123172328.b6trpdpcbzbq4unv@alap3.anarazel.de>
Permalink:  ../20190123172328.b6trpdpcbzbq4unv@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20190123172328.b6trpdpcbzbq4unv@alap3.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: andres@anarazel.de, alvherre@2ndquadrant.com, 9erthalion6@gmail.com, tgl@sss.pgh.pa.us, amitdkhan.pg@gmail.com
  Subject: Re: ArchiveEntry optional arguments refactoring
  In-Reply-To: <20190123172328.b6trpdpcbzbq4unv@alap3.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox