Re: Fix help option of contrib/oid2name

Tatsuro Yamada <yamada.tatsuro@lab.ntt.co.jp>

From: Tatsuro Yamada <yamada.tatsuro@lab.ntt.co.jp>
To: pgsql-hackers@lists.postgresql.org
Date: 2018-08-24T04:28:00Z
Lists: pgsql-hackers

Attachments

On 2018/08/21 12:57, Tatsuro Yamada wrote:
> On 2018/08/21 12:40, Michael Paquier wrote:
>> On Tue, Aug 21, 2018 at 12:26:15PM +0900, Tatsuro Yamada wrote:
>>> BTW, can I add the patch to the Commitfest September?
>>
>> You should.
> 
> Thanks, I'll do that.
> I'll send 2 patches in this week, probably.
I revised the patch and created new tap tests.

fix_oid2name_wip3.patch:
   bug fix
     - Remove "-P password" option from the document
   improvements
     - Divide "Options section" into "Options" and "Connection Options" sections in
       the help message (--help)
     - Add long options
     - Add "-H host" and "-h host" options to the help message and the document
     - Add environment variable (PGHOST, PGPORT and PGUSER) to the document

fix_vacuumlo_wip3.patch:
   improvements
     - Add long options
     - Add environment variable (PGHOST, PGPORT and PGUSER) to the document

Regarding to Long options,
I read the following both codes and I understand meanings of short options, so I
leave all long options in patches not only for connection options.

oid2name.c
	/* these are the opts structures for command line params */
	struct options
	{
	    eary       *tables;
	    eary       *oids;
	    eary       *filenodes;

	    bool        quiet;
	    bool        systables;
	    bool        indexes;
	    bool        nodb;
	    bool        extended;
	    bool        tablespaces;

	    char       *dbname;
	    char       *hostname;
	    char       *port;
	    char       *username;
	    const char *progname;
	};

vacuumlo.c
	struct _param
	{
	    char       *pg_user;
	    enum trivalue pg_prompt;
	    char       *pg_port;
	    char       *pg_host;
	    const char *progname;
	    int         verbose;
	    int         dry_run;
	    long        transaction_limit;
	};


Following TAP tests is for checking command-line options but I coudn't add some
test cases such as it is required argument and mixed varaiety of options.
I'm not sure about naming rule of tap test, so I added 300 and 301 to names as
temporarily. Please rename these files to more suitable names.

   300_oid2name.pl
   301_vacuumlo.pl

Please find attached files.

Thanks,
Tatsuro Yamada

Commits

  1. Rework option set of vacuumlo

  2. Rework option set of oid2name