Re: [HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-06-27 Thread Robert Haas
On Tue, Jun 25, 2013 at 3:09 PM, Fabien COELHO coe...@cri.ensmp.fr wrote:
 I think --quiet-log should be spelled --quiet.

 ISTM that --quiet usually means not verbose on stdout, so I added log
 because this was specific to the log output, and that there may be a need
 for a --quiet option for stdout at some time.

The output that is quieted by -q is not the log output produced by
--log; it's the regular progress output on stdout/stderr.

So I changed that, and committed this, with some further cosmetic
changes.  I made the formatting of the help message more like psql's
help message, including adjusting pgbench to start the description of
each option in the same column that psql does.  This got rid of a lot
of line breaks and IMHO makes the output of pgbench --help quite a bit
more readable.  I made stylistic adjustments to the documentation
portion of the patch as well, again to match the markup used for psql.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-06-27 Thread Fujii Masao
On Thu, Jun 27, 2013 at 10:02 PM, Robert Haas robertmh...@gmail.com wrote:
 On Tue, Jun 25, 2013 at 3:09 PM, Fabien COELHO coe...@cri.ensmp.fr wrote:
 I think --quiet-log should be spelled --quiet.

 ISTM that --quiet usually means not verbose on stdout, so I added log
 because this was specific to the log output, and that there may be a need
 for a --quiet option for stdout at some time.

 The output that is quieted by -q is not the log output produced by
 --log; it's the regular progress output on stdout/stderr.

 So I changed that, and committed this, with some further cosmetic
 changes.  I made the formatting of the help message more like psql's
 help message, including adjusting pgbench to start the description of
 each option in the same column that psql does.  This got rid of a lot
 of line breaks and IMHO makes the output of pgbench --help quite a bit
 more readable.  I made stylistic adjustments to the documentation
 portion of the patch as well, again to match the markup used for psql.

In help messages:

+-s NUM, --scale NUM  scaling factor\n

This should be -s, --scale=NUM for the sake of consistency with other
options.

Regards,

-- 
Fujii Masao


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-06-27 Thread Robert Haas
On Thu, Jun 27, 2013 at 10:24 AM, Fujii Masao masao.fu...@gmail.com wrote:
 On Thu, Jun 27, 2013 at 10:02 PM, Robert Haas robertmh...@gmail.com wrote:
 On Tue, Jun 25, 2013 at 3:09 PM, Fabien COELHO coe...@cri.ensmp.fr wrote:
 I think --quiet-log should be spelled --quiet.

 ISTM that --quiet usually means not verbose on stdout, so I added log
 because this was specific to the log output, and that there may be a need
 for a --quiet option for stdout at some time.

 The output that is quieted by -q is not the log output produced by
 --log; it's the regular progress output on stdout/stderr.

 So I changed that, and committed this, with some further cosmetic
 changes.  I made the formatting of the help message more like psql's
 help message, including adjusting pgbench to start the description of
 each option in the same column that psql does.  This got rid of a lot
 of line breaks and IMHO makes the output of pgbench --help quite a bit
 more readable.  I made stylistic adjustments to the documentation
 portion of the patch as well, again to match the markup used for psql.

 In help messages:

 +-s NUM, --scale NUM  scaling factor\n

 This should be -s, --scale=NUM for the sake of consistency with other
 options.

Woops, missed that one.  Fixed, thanks.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-06-27 Thread Fabien COELHO


[...] So I changed that, and committed this, with some further cosmetic 
changes. [...]


Thanks for the commit  the style improvements.

For the text formatting, I tried to keep the screen width under 80 
characters, because if the line is too wide it is harder to read as the 
eye may loose the alignment. But being homogeneous with other commands is 
fine with me as well.


--
Fabien.


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-06-27 Thread Alvaro Herrera
Fabien COELHO escribió:

 For the text formatting, I tried to keep the screen width under 80
 characters, because if the line is too wide it is harder to read as
 the eye may loose the alignment. But being homogeneous with other
 commands is fine with me as well.

The format chosen by Robert fits in 80 columns and looks very good to
me.  Thanks to both.

-- 
Álvaro Herrerahttp://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training  Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-06-25 Thread Robert Haas
On Thu, Jun 20, 2013 at 9:17 AM, Fabrízio de Royes Mello
fabriziome...@gmail.com wrote:
 On Thu, Jun 20, 2013 at 9:59 AM, Fabien COELHO coe...@cri.ensmp.fr wrote:
 Please fix that and re-send the patch.
 Find attached diff wrt current master.
 Thanks.

I would like to solicit opinions on whether this is a good idea.  I
understand that the patch author thinks it's a good idea, and I don't
have a strong position either way.  But I want to hear what other
people think.

Anyone have an opinion?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-06-25 Thread Andres Freund
On 2013-06-25 12:11:06 -0400, Robert Haas wrote:
 On Thu, Jun 20, 2013 at 9:17 AM, Fabrízio de Royes Mello
 fabriziome...@gmail.com wrote:
  On Thu, Jun 20, 2013 at 9:59 AM, Fabien COELHO coe...@cri.ensmp.fr wrote:
  Please fix that and re-send the patch.
  Find attached diff wrt current master.
  Thanks.
 
 I would like to solicit opinions on whether this is a good idea.  I
 understand that the patch author thinks it's a good idea, and I don't
 have a strong position either way.  But I want to hear what other
 people think.
 
 Anyone have an opinion?

+1. When writing scripts I like to use the long options because that
makes it easier to understand some time later. I don't really see a
reason not to do this.

Greetings,

Andres Freund

-- 
 Andres Freund http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-06-25 Thread Alvaro Herrera
Robert Haas escribió:
 On Thu, Jun 20, 2013 at 9:17 AM, Fabrízio de Royes Mello
 fabriziome...@gmail.com wrote:
  On Thu, Jun 20, 2013 at 9:59 AM, Fabien COELHO coe...@cri.ensmp.fr wrote:
  Please fix that and re-send the patch.
  Find attached diff wrt current master.
  Thanks.
 
 I would like to solicit opinions on whether this is a good idea.  I
 understand that the patch author thinks it's a good idea, and I don't
 have a strong position either way.  But I want to hear what other
 people think.

+1 from me on the general idea.  Didn't check the actual patch.

-- 
Álvaro Herrerahttp://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training  Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-06-25 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes:
 I would like to solicit opinions on whether this is a good idea.  I
 understand that the patch author thinks it's a good idea, and I don't
 have a strong position either way.  But I want to hear what other
 people think.

If it makes pgbench more consistent with psql's command line options,
it seems reasonable to me.

regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-06-25 Thread Robert Haas
On Tue, Jun 25, 2013 at 12:17 PM, Tom Lane t...@sss.pgh.pa.us wrote:
 Robert Haas robertmh...@gmail.com writes:
 I would like to solicit opinions on whether this is a good idea.  I
 understand that the patch author thinks it's a good idea, and I don't
 have a strong position either way.  But I want to hear what other
 people think.

 If it makes pgbench more consistent with psql's command line options,
 it seems reasonable to me.

OK, I think it does that.  So that's three votes in favor and none
opposed.  I think I'd like to quibble with some of the names a bit,
though.  The patch adds --fill-factor, but I think we should spell it
without the hyphen: --fillfactor.  I think --quiet-log should be
spelled --quiet.  I think --connect for each connection is not very
descriptive; maybe --connection-per-transaction or something, although
that's kind of long.  I think -M should be aliased to --protocol, not
--query-mode.  --skip-some-update is incorrectly pluralized; if that's
what we're going to use, it should be --skip-some-updates.
Alternatively, we could use --update-large-tables-only, which might
make the intent more clear.

On another note, it doesn't look like this updates the output of
pgbench --help, which seems important.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-06-25 Thread Fabien COELHO



I think I'd like to quibble with some of the names a bit, though.


That is a good idea, because I'm not a native English speaker and I was 
not so sure for many options.



The patch adds --fill-factor, but I think we should spell it
without the hyphen: --fillfactor.


Fine with me.


I think --quiet-log should be spelled --quiet.


ISTM that --quiet usually means not verbose on stdout, so I added log 
because this was specific to the log output, and that there may be a need 
for a --quiet option for stdout at some time.


I think --connect for each connection is not very descriptive; maybe 
--connection-per-transaction or something, although that's kind of long.


Yes, I think that it is too long. You have to type them!

What about '--reconnect'?


 I think -M should be aliased to --protocol, not --query-mode.


Fine with me.


--skip-some-update is incorrectly pluralized; if that's
what we're going to use, it should be --skip-some-updates.


Indeed.


Alternatively, we could use --update-large-tables-only, which might
make the intent more clear.


Yep, but quite long.


On another note, it doesn't look like this updates the output of
pgbench --help, which seems important.


Indeed, it should.

Please find attached a v4 which takes into account most of your comments, 
but very very long option names.


--
Fabien.diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c
index 1303217..e8126f5 100644
--- a/contrib/pgbench/pgbench.c
+++ b/contrib/pgbench/pgbench.c
@@ -329,11 +329,16 @@ usage(void)
 		   Usage:\n
 		 %s [OPTION]... [DBNAME]\n
 		   \nInitialization options:\n
-		 -i   invokes initialization mode\n
-		 -F NUM   fill factor\n
-		 -n   do not run VACUUM after initialization\n
-		 -q   quiet logging (one message each 5 seconds)\n
-		 -s NUM   scaling factor\n
+		 -i, --initialize\n
+		  invokes initialization mode\n
+		 -F NUM, --fillfactor NUM\n
+		  set fill factor\n
+		 -n, --no-vacuum\n
+		  do not run VACUUM after initialization\n
+		 -q, --quiet-log\n
+		  quiet logging (one message each 5 seconds)\n
+		 -s NUM, --scale NUM\n
+		  scaling factor\n
 		 --foreign-keys\n
 		  create foreign key constraints between tables\n
 		 --index-tablespace=TABLESPACE\n
@@ -343,32 +348,50 @@ usage(void)
 		 --unlogged-tables\n
 		  create tables as unlogged tables\n
 		   \nBenchmarking options:\n
-		  -c NUM   number of concurrent database clients (default: 1)\n
-		 -C   establish new connection for each transaction\n
-		 -D VARNAME=VALUE\n
+		 -c NUM, --client NUM\n
+		  number of concurrent database clients (default: 1)\n
+		 -C, --connect\n
+		  establish new connection for each transaction\n
+		 -D VARNAME=VALUE, --define VARNAME=VALUE\n
 		  define variable for use by custom script\n
-		 -f FILENAME  read transaction script from FILENAME\n
-		 -j NUM   number of threads (default: 1)\n
-		 -l   write transaction times to log file\n
-		 -M simple|extended|prepared\n
-		  protocol for submitting queries to server (default: simple)\n
-		 -n   do not run VACUUM before tests\n
-		 -N   do not update tables \pgbench_tellers\ and \pgbench_branches\\n
-		 -r   report average latency per command\n
-		 -s NUM   report this scale factor in output\n
-		 -S   perform SELECT-only transactions\n
-	   -t NUM   number of transactions each client runs (default: 10)\n
-		 -T NUM   duration of benchmark test in seconds\n
-		 -v   vacuum all four standard tables before tests\n
+		 -f FILENAME, --file FILENAME\n
+		  read transaction script from FILENAME\n
+		 -j NUM, --jobs NUM\n
+		  number of threads (default: 1)\n
+		 -l, --logwrite transaction times to log file\n
+		 -M simple|extended|prepared, --protocole ...\n
+		  protocol for submitting queries to server 
+		   (default: simple)\n
+		 -n, --no-vacuum\n
+		  do not run VACUUM before tests\n
+		 -N, --skip-some-updates\n
+		  do not update tables \pgbench_tellers\
+		  and \pgbench_branches\\n
+		 -r, --report-latencies\n
+		  report average latency per command\n
+		 -s NUM, --scale NUM\n
+		  report this scale factor in output\n
+		 -S, --select-only\n
+		  perform SELECT-only transactions\n
+		 -t NUM, --transactions NUM\n
+		  number of transactions each client runs 
+		 (default: 10)\n
+		 -T NUM, --time NUM\n
+		  duration of 

Re: [HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-06-20 Thread Fabien COELHO



Please fix that and re-send the patch.


Find attached diff wrt current master.

--
Fabien.diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c
index 1303217..f39fed3 100644
--- a/contrib/pgbench/pgbench.c
+++ b/contrib/pgbench/pgbench.c
@@ -2109,6 +2109,30 @@ int
 main(int argc, char **argv)
 {
 	static struct option long_options[] = {
+		/* systematic long/short named options*/
+		{client, required_argument, NULL, 'c'},
+		{connect, no_argument, NULL, 'C'},
+		{debug, no_argument, NULL, 'd'},
+		{define, required_argument, NULL, 'D'},
+		{file, required_argument, NULL, 'f'},
+		{fill-factor, required_argument, NULL, 'F'},
+		{host, required_argument, NULL, 'h'},
+		{initialize, no_argument, NULL, 'i'},
+		{jobs, required_argument, NULL, 'j'},
+		{log, no_argument, NULL, 'l'},
+		{no-vacuum, no_argument, NULL, 'n'},
+		{port, required_argument, NULL, 'p'},
+		{query-mode, required_argument, NULL, 'M'},
+		{quiet-log, no_argument, NULL, 'q'},
+		{report-latencies, no_argument, NULL, 'r'},
+		{scale, required_argument, NULL, 's'},
+		{select-only, no_argument, NULL, 'S'},
+		{skip-some-update, no_argument, NULL, 'N'},
+		{time, required_argument, NULL, 'T'},
+		{transactions, required_argument, NULL, 't'},
+		{username, required_argument, NULL, 'U'},
+		{vacuum-all, no_argument, NULL, 'v'},
+		/* long-named only options */
 		{foreign-keys, no_argument, foreign_keys, 1},
 		{index-tablespace, required_argument, NULL, 3},
 		{tablespace, required_argument, NULL, 2},
diff --git a/doc/src/sgml/pgbench.sgml b/doc/src/sgml/pgbench.sgml
index 8775606..3394b93 100644
--- a/doc/src/sgml/pgbench.sgml
+++ b/doc/src/sgml/pgbench.sgml
@@ -150,6 +150,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-i/option/term
+  termoption--initialize/option/term
   listitem
para
 Required to invoke initialization mode.
@@ -159,6 +160,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-F/option replaceablefillfactor//term
+  termoption--fill-factor/option replaceablefillfactor//term
   listitem
para
 Create the structnamepgbench_accounts/,
@@ -171,6 +173,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-n/option/term
+  termoption--no-vacuum/option/term
   listitem
para
 Perform no vacuuming after initialization.
@@ -180,6 +183,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-q/option/term
+  termoption--quiet-log/option/term
   listitem
para
 Switch logging to quiet mode, producing only one progress message per 5
@@ -191,6 +195,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-s/option replaceablescale_factor//term
+  termoption--scale/option replaceablescale_factor//term
   listitem
para
 Multiply the number of rows generated by the scale factor.
@@ -259,6 +264,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-c/option replaceableclients//term
+  termoption--client/option replaceableclients//term
   listitem
para
 Number of clients simulated, that is, number of concurrent database
@@ -269,6 +275,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-C/option/term
+  termoption--connect/option/term
   listitem
para
 Establish a new connection for each transaction, rather than
@@ -280,6 +287,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-d/option/term
+  termoption--debug/option/term
   listitem
para
 Print debugging output.
@@ -289,6 +297,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-D/option replaceablevarname/literal=/replaceablevalue//term
+  termoption--define/option replaceablevarname/literal=/replaceablevalue//term
   listitem
para
 Define a variable for use by a custom script (see below).
@@ -299,6 +308,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-f/option replaceablefilename//term
+  termoption--file/option replaceablefilename//term
   listitem
para
 Read transaction script from replaceablefilename/.
@@ -311,6 +321,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-j/option replaceablethreads//term
+  termoption--jobs/option replaceablethreads//term
   listitem
para
 Number of worker threads within applicationpgbench/application.
@@ -324,6 +335,7 @@ pgbench optional replaceableoptions/ /optional 

Re: [HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-06-20 Thread Fabrízio de Royes Mello
On Thu, Jun 20, 2013 at 9:59 AM, Fabien COELHO coe...@cri.ensmp.fr wrote:


  Please fix that and re-send the patch.


 Find attached diff wrt current master.


Thanks.


-- 
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
 Blog sobre TI: http://fabriziomello.blogspot.com
 Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
 Twitter: http://twitter.com/fabriziomello


Re: [HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-06-19 Thread fabriziomello
 New submission which put long options in alphabetical order, which seems 
 more logical.

 This is for reference to the next commitfest.

When I applied your patch appeared the following messages:

$ patch -p1  /tmp/pgbench-longopts.patch 
patching file contrib/pgbench/pgbench.c
Hunk #1 succeeded at 2109 (offset 29 lines).
patching file doc/src/sgml/pgbench.sgml
Hunk #2 succeeded at 172 (offset 12 lines).
Hunk #3 FAILED at 170.
Hunk #4 succeeded at 193 (offset 11 lines).
Hunk #5 FAILED at 199.
Hunk #13 succeeded at 344 (offset -33 lines).
Hunk #14 succeeded at 367 (offset -33 lines).
Hunk #15 succeeded at 382 (offset -33 lines).
Hunk #16 succeeded at 395 (offset -33 lines).
Hunk #17 succeeded at 407 (offset -33 lines).
Hunk #18 succeeded at 422 (offset -33 lines).
Hunk #19 succeeded at 432 (offset -33 lines).
Hunk #20 succeeded at 442 (offset -33 lines).
Hunk #21 succeeded at 454 (offset -33 lines).
2 out of 24 hunks FAILED -- saving rejects to file
doc/src/sgml/pgbench.sgml.rej

Please fix that and re-send the patch.

Regards,




-
-- 
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
 Blog sobre TI: http://fabriziomello.blogspot.com
 Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
 Twitter: http://twitter.com/fabriziomello
--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/PATCH-add-long-options-to-pgbench-submission-1-tp5754115p5760039.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-05-12 Thread Fabien COELHO


New submission which put long options in alphabetical order, which seems 
more logical.


This is for reference to the next commitfest.

--
Fabien.diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c
index 24dab1f..ba36e66 100644
--- a/contrib/pgbench/pgbench.c
+++ b/contrib/pgbench/pgbench.c
@@ -2080,6 +2080,30 @@ int
 main(int argc, char **argv)
 {
 	static struct option long_options[] = {
+		/* systematic long/short named options*/
+		{client, required_argument, NULL, 'c'},
+		{connect, no_argument, NULL, 'C'},
+		{debug, no_argument, NULL, 'd'},
+		{define, required_argument, NULL, 'D'},
+		{file, required_argument, NULL, 'f'},
+		{fill-factor, required_argument, NULL, 'F'},
+		{host, required_argument, NULL, 'h'},
+		{initialize, no_argument, NULL, 'i'},
+		{jobs, required_argument, NULL, 'j'},
+		{log, no_argument, NULL, 'l'},
+		{no-vacuum, no_argument, NULL, 'n'},
+		{port, required_argument, NULL, 'p'},
+		{query-mode, required_argument, NULL, 'M'},
+		{quiet-log, no_argument, NULL, 'q'},
+		{report-latencies, no_argument, NULL, 'r'},
+		{scale, required_argument, NULL, 's'},
+		{select-only, no_argument, NULL, 'S'},
+		{skip-some-update, no_argument, NULL, 'N'},
+		{time, required_argument, NULL, 'T'},
+		{transactions, required_argument, NULL, 't'},
+		{username, required_argument, NULL, 'U'},
+		{vacuum-all, no_argument, NULL, 'v'},
+		/* long-named only options */
 		{foreign-keys, no_argument, foreign_keys, 1},
 		{index-tablespace, required_argument, NULL, 3},
 		{tablespace, required_argument, NULL, 2},
diff --git a/doc/src/sgml/pgbench.sgml b/doc/src/sgml/pgbench.sgml
index 79b4baf..bc84ec0 100644
--- a/doc/src/sgml/pgbench.sgml
+++ b/doc/src/sgml/pgbench.sgml
@@ -150,6 +150,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-i/option/term
+  termoption--initialize/option/term
   listitem
para
 Required to invoke initialization mode.
@@ -159,6 +160,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-n/option/term
+  termoption--no-vacuum/option/term
   listitem
para
 Perform no vacuuming after initialization.
@@ -168,6 +170,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-F/option replaceablefillfactor//term
+  termoption--fill-factor/option replaceablefillfactor//term
   listitem
para
 Create the structnamepgbench_accounts/,
@@ -180,6 +183,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-s/option replaceablescale_factor//term
+  termoption--scale/option replaceablescale_factor//term
   listitem
para
 Multiply the number of rows generated by the scale factor.
@@ -196,6 +200,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-q/option/term
+  termoption--quiet-log/option/term
   listitem
para
 Switch logging to quiet mode, producing only one progress message per 5
@@ -259,6 +264,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-c/option replaceableclients//term
+  termoption--client/option replaceableclients//term
   listitem
para
 Number of clients simulated, that is, number of concurrent database
@@ -269,6 +275,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-C/option/term
+  termoption--connect/option/term
   listitem
para
 Establish a new connection for each transaction, rather than
@@ -280,6 +287,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-d/option/term
+  termoption--debug/option/term
   listitem
para
 Print debugging output.
@@ -289,6 +297,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-D/option replaceablevarname/literal=/replaceablevalue//term
+  termoption--define/option replaceablevarname/literal=/replaceablevalue//term
   listitem
para
 Define a variable for use by a custom script (see below).
@@ -299,6 +308,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-f/option replaceablefilename//term
+  termoption--file/option replaceablefilename//term
   listitem
para
 Read transaction script from replaceablefilename/.
@@ -311,6 +321,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-j/option replaceablethreads//term
+  termoption--jobs/option replaceablethreads//term
   listitem
para
 Number of worker threads within applicationpgbench/application.
@@ -324,6 

Re: [HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-05-07 Thread Fabien COELHO


Hello Robert,

This very minor patch adds a corresponding long option to all short 
(one letter) options of pgbench. [...]


I don't really have an opinion on whether this is worth doing, but we'd 
probably want to update all of our client utilities, not just pgbench, 
if we did.


The current status is that official clients already have systematic long 
options. I have checked: psql, pg_dump, pg_dumpall, pg_restore, 
pg_basebackup, createdb, createuser, createlang. Possibly other commands 
in contrib do not have long option.


As for the rational, when I type interactively I tend to use short 
options, but in a script I like long options so that I may not need to 
look them up in the documentation too often when reading the script later.
The other rational is that adding long options is cheap and 
straightforward.


--
Fabien.


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-05-06 Thread Robert Haas
On Thu, May 2, 2013 at 1:59 PM, Fabien COELHO coe...@cri.ensmp.fr wrote:
 This is mostly for reference to the next commitfest.

 This very minor patch adds a corresponding long option to all short (one
 letter) options of pgbench. In particular for connection options there is
 now --host --username --port options similar to the psql client.

 While I was at developing some small extensions to pgbench, ISTM that I
 could do that without much effort.

I don't really have an opinion on whether this is worth doing, but
we'd probably want to update all of our client utilities, not just
pgbench, if we did.

 Note that I'm not so sure about whether to chose singular or plural long
 option names.

I've wondered that myself.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] [PATCH] add long options to pgbench (submission 1)

2013-05-02 Thread Fabien COELHO


This is mostly for reference to the next commitfest.

This very minor patch adds a corresponding long option to all short (one 
letter) options of pgbench. In particular for connection options there is 
now --host --username --port options similar to the psql client.


While I was at developing some small extensions to pgbench, ISTM that I 
could do that without much effort.


Note that I'm not so sure about whether to chose singular or plural long 
option names.


--
Fabien.diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c
index bc01f07..7109305 100644
--- a/contrib/pgbench/pgbench.c
+++ b/contrib/pgbench/pgbench.c
@@ -2080,6 +2080,30 @@ int
 main(int argc, char **argv)
 {
 	static struct option long_options[] = {
+		/* long/short named options*/
+		{initialize, no_argument, NULL, 'i'},
+		{host, required_argument, NULL, 'h'},
+		{no-vacuum, no_argument, NULL, 'n'},
+		{vacuum-all, no_argument, NULL, 'v'},
+		{port, required_argument, NULL, 'p'},
+		{debug, no_argument, NULL, 'd'},
+		{select-only, no_argument, NULL, 'S'},
+		{skip-some-update, no_argument, NULL, 'N'},
+		{client, required_argument, NULL, 'c'},
+		{jobs, required_argument, NULL, 'j'},
+		{connect, no_argument, NULL, 'C'},
+		{report-latencies, no_argument, NULL, 'r'},
+		{scale, required_argument, NULL, 's'},
+		{transactions, required_argument, NULL, 't'},
+		{time, required_argument, NULL, 'T'},
+		{username, required_argument, NULL, 'U'},
+		{log, no_argument, NULL, 'l'},
+		{quiet-log, no_argument, NULL, 'q'},
+		{file, required_argument, NULL, 'f'},
+		{define, required_argument, NULL, 'D'},
+		{fill-factor, required_argument, NULL, 'F'},
+		{query-mode, required_argument, NULL, 'M'},
+		/* long-named only options */
 		{foreign-keys, no_argument, foreign_keys, 1},
 		{index-tablespace, required_argument, NULL, 3},
 		{tablespace, required_argument, NULL, 2},
diff --git a/doc/src/sgml/pgbench.sgml b/doc/src/sgml/pgbench.sgml
index 79b4baf..bc84ec0 100644
--- a/doc/src/sgml/pgbench.sgml
+++ b/doc/src/sgml/pgbench.sgml
@@ -150,6 +150,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-i/option/term
+  termoption--initialize/option/term
   listitem
para
 Required to invoke initialization mode.
@@ -159,6 +160,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-n/option/term
+  termoption--no-vacuum/option/term
   listitem
para
 Perform no vacuuming after initialization.
@@ -168,6 +170,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-F/option replaceablefillfactor//term
+  termoption--fill-factor/option replaceablefillfactor//term
   listitem
para
 Create the structnamepgbench_accounts/,
@@ -180,6 +183,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-s/option replaceablescale_factor//term
+  termoption--scale/option replaceablescale_factor//term
   listitem
para
 Multiply the number of rows generated by the scale factor.
@@ -196,6 +200,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-q/option/term
+  termoption--quiet-log/option/term
   listitem
para
 Switch logging to quiet mode, producing only one progress message per 5
@@ -259,6 +264,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-c/option replaceableclients//term
+  termoption--client/option replaceableclients//term
   listitem
para
 Number of clients simulated, that is, number of concurrent database
@@ -269,6 +275,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-C/option/term
+  termoption--connect/option/term
   listitem
para
 Establish a new connection for each transaction, rather than
@@ -280,6 +287,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-d/option/term
+  termoption--debug/option/term
   listitem
para
 Print debugging output.
@@ -289,6 +297,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-D/option replaceablevarname/literal=/replaceablevalue//term
+  termoption--define/option replaceablevarname/literal=/replaceablevalue//term
   listitem
para
 Define a variable for use by a custom script (see below).
@@ -299,6 +308,7 @@ pgbench optional replaceableoptions/ /optional replaceabledbname/
 
  varlistentry
   termoption-f/option replaceablefilename//term
+  termoption--file/option replaceablefilename//term
   listitem
para
 Read transaction script from replaceablefilename/.
@@