Re: Multiple --table options for other commands

Lists: pgsql-hackers
From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Multiple --table options for other commands
Date: 2012-10-28 23:30:45
Message-ID: CAK3UJRG+yV1mK5twLfKVMCwXH4f6PnJou6Rn=ecabyfQH1vVHg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi all,

I see there's already a TODO for allowing pg_restore to accept
multiple --table arguments[1], but would folks support adding this
capability to various other commands which currently accept only a
single --table argument, such as clusterdb, vacuumdb, and reindexdb?

Looking at pg_dump, it seems like these other commands would want to
use the SimpleStringList / SimpleStringCell machinery which currently
lives only in pg_dump. I'm guessing that ./src/bin/pg_dump/dumputils.c
would be the right place for such common code?

Josh

[1] http://archives.postgresql.org/pgsql-hackers/2010-08/msg00689.php


From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multiple --table options for other commands
Date: 2012-10-31 03:14:19
Message-ID: CAK3UJRGSkO+Wo_8Rat1UquQYCMZGH=xh+n3Z=zen1kdJ2PJ_ug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Oct 28, 2012 at 4:30 PM, Josh Kupershmidt <schmiddy(at)gmail(dot)com> wrote:

> I see there's already a TODO for allowing pg_restore to accept
> multiple --table arguments[1], but would folks support adding this
> capability to various other commands which currently accept only a
> single --table argument, such as clusterdb, vacuumdb, and reindexdb?

I went ahead and cooked up a patch to allow pg_restore, clusterdb,
vacuumdb, and reindexdb to accept multiple --table switches. Hope I
didn't overlook a similar tool, but these were the only other commands
I found taking a --table argument.

If you run, say:
pg_dump -Fc --table=tab1 --table=tab2 ... |
pg_restore --table=tab1 --table=tab2 ...

without the patch, only "tab2" will be restored and pg_restore will
make no mention of this omission to the user. With the patch, both
tables should be restored.

I also added support for multiple --index options for reindexdb, since
that use-case seemed symmetrical to --table. As suggested previously,
I moved the SimpleStringList types and functions out of pg_dump.h and
common.c into dumputils.{h,c}, so that the code in ./src/bin/scripts/
could use it.

If there are no objections, I can add the patch to the next CF.

Josh

Attachment Content-Type Size
multiple_tables.v1.diff application/octet-stream 23.6 KB

From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multiple --table options for other commands
Date: 2012-12-11 03:23:03
Message-ID: 1355196183.6191.0@mofo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 10/30/2012 10:14:19 PM, Josh Kupershmidt wrote:

> I went ahead and cooked up a patch to allow pg_restore, clusterdb,
> vacuumdb, and reindexdb to accept multiple --table switches. Hope I
> didn't overlook a similar tool, but these were the only other
> commands
> I found taking a --table argument.

I believe you need ellipses behind --table in the syntax summaries
of the command reference docs.

(This was all I noticed while reading the patch.)

Regards,

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein


From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multiple --table options for other commands
Date: 2012-12-11 18:46:12
Message-ID: 1355251572.14201.1@mofo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi Josh,

I've signed up to review this patch.

I configured with assertions, built, and tested using
the attached script. It seems to do what it's supposed
to and the code looks ok to me.

The docs build. The text is reasonable.

I also diffed the output of the attached script with
the output of an unpatched head and got what I expected.

Yes, the current pg_restore silently
ignores multiple --table arguments, and seems to use the last
one. You are introducing a backwards incompatible
change here. I don't know what to do about it, other
than perhaps to have the patch go into 10.0 (!?) and
introduce a patch now that complains about multiple
--table arguments. On the other hand, perhaps it's
simply undocumented what pg_restore does when
given repeated, conflicting, arguments and we're
free to change this. Any thoughts?

On 12/10/2012 09:23:03 PM, Karl O. Pinc wrote:
> On 10/30/2012 10:14:19 PM, Josh Kupershmidt wrote:
>
> > I went ahead and cooked up a patch to allow pg_restore, clusterdb,
> > vacuumdb, and reindexdb to accept multiple --table switches. Hope I
> > didn't overlook a similar tool, but these were the only other
> > commands
> > I found taking a --table argument.
>
> I believe you need ellipses behind --table in the syntax summaries
> of the command reference docs.

I also note that the pg_dump --help output says "table(s)" so
you probably want to have pg_restore say the same now that it
takes multiple tables.

These two minor points seem to be all that needs fixing.

Regards,

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

Attachment Content-Type Size
tablearg.sh application/x-shellscript 4.0 KB

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
Cc: Josh Kupershmidt <schmiddy(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multiple --table options for other commands
Date: 2012-12-11 20:07:29
Message-ID: CA+TgmobAJ9Xqmk+wD5CH+1FoCo4FUJB8VGzBzFsc2rUaUwgX5Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 11, 2012 at 1:46 PM, Karl O. Pinc <kop(at)meme(dot)com> wrote:
> Yes, the current pg_restore silently
> ignores multiple --table arguments, and seems to use the last
> one. You are introducing a backwards incompatible
> change here. I don't know what to do about it, other
> than perhaps to have the patch go into 10.0 (!?) and
> introduce a patch now that complains about multiple
> --table arguments. On the other hand, perhaps it's
> simply undocumented what pg_restore does when
> given repeated, conflicting, arguments and we're
> free to change this. Any thoughts?

I wouldn't worry about this. I don't think we're obliged to be
bug-compatible with our own prior releases. We've made far bigger
changes for far less meritorious reasons.

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


From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multiple --table options for other commands
Date: 2012-12-12 04:25:43
Message-ID: CAK3UJRG=R6JQ-VVWJuUz_QYnigBLZMc-952TTqdj5Rpmv-F2Kg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 11, 2012 at 11:46 AM, Karl O. Pinc <kop(at)meme(dot)com> wrote:
> Hi Josh,
>
> I've signed up to review this patch.

Thanks!

> I configured with assertions, built, and tested using
> the attached script. It seems to do what it's supposed
> to and the code looks ok to me.
>
> The docs build. The text is reasonable.
>
> I also diffed the output of the attached script with
> the output of an unpatched head and got what I expected.

Cool test script.

> Yes, the current pg_restore silently
> ignores multiple --table arguments, and seems to use the last
> one. You are introducing a backwards incompatible
> change here. I don't know what to do about it, other
> than perhaps to have the patch go into 10.0 (!?) and
> introduce a patch now that complains about multiple
> --table arguments. On the other hand, perhaps it's
> simply undocumented what pg_restore does when
> given repeated, conflicting, arguments and we're
> free to change this. Any thoughts?

Agreed with Robert that this change should be reasonable in a major
version (i.e. 9.3).

> On 12/10/2012 09:23:03 PM, Karl O. Pinc wrote:
>> On 10/30/2012 10:14:19 PM, Josh Kupershmidt wrote:
>>
>> > I went ahead and cooked up a patch to allow pg_restore, clusterdb,
>> > vacuumdb, and reindexdb to accept multiple --table switches. Hope I
>> > didn't overlook a similar tool, but these were the only other
>> > commands
>> > I found taking a --table argument.
>>
>> I believe you need ellipses behind --table in the syntax summaries
>> of the command reference docs.

Hrm, I was following pg_dump's lead here for the .sgml docs, and
didn't see anywhere that pg_dump makes the multiple --table syntax
explicit other than in the explanatory text underneath the option.

> I also note that the pg_dump --help output says "table(s)" so
> you probably want to have pg_restore say the same now that it
> takes multiple tables.

Good catch, will fix, and ditto reindexdb's --index help output. (It
is possible that the --help output for pg_dump was worded to say
"table(s)" because one can use a "pattern" --table specification with
pg_dump, though IMO it's helpful to mention "table(s)" in the --help
output for the rest of these programs as well, as a little reminder to
the user.)

Josh

Attachment Content-Type Size
multiple_tables.v2.diff application/octet-stream 25.2 KB

From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multiple --table options for other commands
Date: 2012-12-12 15:14:51
Message-ID: 1355325291.32370.2@mofo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 12/11/2012 10:25:43 PM, Josh Kupershmidt wrote:
> On Tue, Dec 11, 2012 at 11:46 AM, Karl O. Pinc <kop(at)meme(dot)com> wrote:

> > Yes, the current pg_restore silently
> > ignores multiple --table arguments, and seems to use the last
> > one. You are introducing a backwards incompatible
> > change here.

> Agreed with Robert that this change should be reasonable in a major
> version (i.e. 9.3).

Good by me. Seemed worth a mention.

> >> I believe you need ellipses behind --table in the syntax summaries
> >> of the command reference docs.
>
> Hrm, I was following pg_dump's lead here for the .sgml docs, and
> didn't see anywhere that pg_dump makes the multiple --table syntax
> explicit other than in the explanatory text underneath the option.

Yes. I see. I didn't look at all the command's reference pages
but did happen to look at clusterdb, which does have --table
in the syntax summary. I just checked and you need to fix
clusterdb, reindexdb, and vacuumdb.

> > I also note that the pg_dump --help output says "table(s)" so
> > you probably want to have pg_restore say the same now that it
> > takes multiple tables.
>
> Good catch, will fix, and ditto reindexdb's --index help output. (It
> is possible that the --help output for pg_dump was worded to say
> "table(s)" because one can use a "pattern" --table specification with
> pg_dump, though IMO it's helpful to mention "table(s)" in the --help
> output for the rest of these programs as well, as a little reminder
> to
> the user.)

Agreed.

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein


From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multiple --table options for other commands
Date: 2012-12-13 05:04:53
Message-ID: CAK3UJRGkMO+W10sfVYoD-31qKm5WqByqiNxLAyeyDre4f0-QXg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Dec 12, 2012 at 8:14 AM, Karl O. Pinc <kop(at)meme(dot)com> wrote:
> On 12/11/2012 10:25:43 PM, Josh Kupershmidt wrote:
>> On Tue, Dec 11, 2012 at 11:46 AM, Karl O. Pinc <kop(at)meme(dot)com> wrote:
>> >> I believe you need ellipses behind --table in the syntax summaries
>> >> of the command reference docs.
>>
>> Hrm, I was following pg_dump's lead here for the .sgml docs, and
>> didn't see anywhere that pg_dump makes the multiple --table syntax
>> explicit other than in the explanatory text underneath the option.
>
> Yes. I see. I didn't look at all the command's reference pages
> but did happen to look at clusterdb, which does have --table
> in the syntax summary. I just checked and you need to fix
> clusterdb, reindexdb, and vacuumdb.

OK, I made some changes to the command synopses for these three
commands. For some reason, reindexdb.sgml was slightly different from
the other two, in that the --table and --index bits were underneath a
<group> node instead of <arg>. I've changed that one to be like the
other two, and made them all have:
<arg choice="opt" rep="repeat">

to include the ellipses after the table -- I hope that matches what
you had in mind.

Josh

Attachment Content-Type Size
multiple_tables.v3.diff application/octet-stream 28.5 KB

From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multiple --table options for other commands
Date: 2012-12-13 06:35:14
Message-ID: 1355380514.26790.10@mofo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi Josh,

The good news is that there's only this little bit of
documentation formatting to fix....

On 12/12/2012 11:04:53 PM, Josh Kupershmidt wrote:
> On Wed, Dec 12, 2012 at 8:14 AM, Karl O. Pinc <kop(at)meme(dot)com> wrote:
> > On 12/11/2012 10:25:43 PM, Josh Kupershmidt wrote:
> >> On Tue, Dec 11, 2012 at 11:46 AM, Karl O. Pinc <kop(at)meme(dot)com>
> wrote:
> >> >> I believe you need ellipses behind --table in the syntax
> summaries
> >> >> of the command reference docs.

> > Yes. I see. I didn't look at all the command's reference pages
> > but did happen to look at clusterdb, which does have --table
> > in the syntax summary. I just checked and you need to fix
> > clusterdb, reindexdb, and vacuumdb.
>
> OK, I made some changes to the command synopses for these three
> commands. For some reason, reindexdb.sgml was slightly different from
> the other two, in that the --table and --index bits were underneath a
> <group> node instead of <arg>. I've changed that one to be like the
> other two, and made them all have:
> <arg choice="opt" rep="repeat">
>
> to include the ellipses after the table -- I hope that matches what
> you had in mind.

Sadly, the ... is in the wrong place in all 3. Yours looks like (for
2 examples):

vacuumdb [connection-option...] [option...] [ --table | -t table
[( column [,...] )] ...] [dbname]

reindexdb [connection-option...] [ --table | -t table ...] [ --index |
-i index ...] [dbname]

I want the ... outside the square braces, because the --table (or -t)
must repeat for each table specified. Like:

vacuumdb [connection-option...] [option...] [ --table | -t table
[( column [,...] )] ]... [dbname]

reindexdb [connection-option...] [ --table | -t table ]... [ --index |
-i index ]... [dbname]

Sorry, I don't see any examples in the existing docs of how this is
done.

It seems like what you have should work, although perhaps
somehow that's the difference between the <arg> and <group>
and you need to switch them back to how reindex used to
be. Otherwise, there's the docs at docbook.org, and
the docbook mailing lists. Or maybe the stylesheets
are broken. (Always blame the tool! It's never _our_
fault! ;-)

Have you had trouble getting this to work?
Maybe someone who knows what they're doing will step
in and give us the answer.

Regards,

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein


From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multiple --table options for other commands
Date: 2012-12-13 13:05:57
Message-ID: 1355403957.26790.11@mofo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 12/13/2012 12:35:14 AM, Karl O. Pinc wrote:

> On 12/12/2012 11:04:53 PM, Josh Kupershmidt wrote:
> > On Wed, Dec 12, 2012 at 8:14 AM, Karl O. Pinc <kop(at)meme(dot)com> wrote:
> > > On 12/11/2012 10:25:43 PM, Josh Kupershmidt wrote:
> > >> On Tue, Dec 11, 2012 at 11:46 AM, Karl O. Pinc <kop(at)meme(dot)com>
> > wrote:
> > >> >> I believe you need ellipses behind --table in the syntax
> > summaries
> > >> >> of the command reference docs.
>
>
> > > Yes. I see. I didn't look at all the command's reference pages
> > > but did happen to look at clusterdb, which does have --table
> > > in the syntax summary. I just checked and you need to fix
> > > clusterdb, reindexdb, and vacuumdb.
> >
> > OK, I made some changes to the command synopses for these three
> > commands.

> I want the ... outside the square braces, because the --table (or -t)
> must repeat for each table specified. Like:
>
> vacuumdb [connection-option...] [option...] [ --table | -t table
> [( column [,...] )] ]... [dbname]
>
> reindexdb [connection-option...] [ --table | -t table ]... [ --index
> |
>
> -i index ]... [dbname]

> Have you had trouble getting this to work?

Perhaps <arg choice="opt"><arg rep="repeat"> ... would work?

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein


From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multiple --table options for other commands
Date: 2012-12-14 01:37:27
Message-ID: CAK3UJREQrPGytUPTC_kOQ2Tg-2hasP++-m94PgTa2ZaeHddmqg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Dec 13, 2012 at 6:05 AM, Karl O. Pinc <kop(at)meme(dot)com> wrote:
> On 12/13/2012 12:35:14 AM, Karl O. Pinc wrote:
>
>> On 12/12/2012 11:04:53 PM, Josh Kupershmidt wrote:
>> > On Wed, Dec 12, 2012 at 8:14 AM, Karl O. Pinc <kop(at)meme(dot)com> wrote:
>> > > On 12/11/2012 10:25:43 PM, Josh Kupershmidt wrote:
>> > >> On Tue, Dec 11, 2012 at 11:46 AM, Karl O. Pinc <kop(at)meme(dot)com>
>> > wrote:
>> > >> >> I believe you need ellipses behind --table in the syntax
>> > summaries
>> > >> >> of the command reference docs.
>>
>>
>> > > Yes. I see. I didn't look at all the command's reference pages
>> > > but did happen to look at clusterdb, which does have --table
>> > > in the syntax summary. I just checked and you need to fix
>> > > clusterdb, reindexdb, and vacuumdb.
>> >
>> > OK, I made some changes to the command synopses for these three
>> > commands.
>
>> I want the ... outside the square braces, because the --table (or -t)
>> must repeat for each table specified. Like:
>>
>> vacuumdb [connection-option...] [option...] [ --table | -t table
>> [( column [,...] )] ]... [dbname]
>>
>> reindexdb [connection-option...] [ --table | -t table ]... [ --index
>> |
>>
>> -i index ]... [dbname]
>
>> Have you had trouble getting this to work?
>
> Perhaps <arg choice="opt"><arg rep="repeat"> ... would work?

Well, I fooled around with the SGML for a bit and came up with
something which has the ellipses in brackets:

[ --table | -t table ] [...]

which I like a little better than not having the second set of
brackets. New version attached.

Josh

Attachment Content-Type Size
multiple_tables.v04.diff application/octet-stream 28.5 KB

From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multiple --table options for other commands
Date: 2012-12-14 02:24:25
Message-ID: 1355451865.26124.9@mofo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 12/13/2012 07:37:27 PM, Josh Kupershmidt wrote:
> On Thu, Dec 13, 2012 at 6:05 AM, Karl O. Pinc <kop(at)meme(dot)com> wrote:
> > On 12/13/2012 12:35:14 AM, Karl O. Pinc wrote:
> >
> >> On 12/12/2012 11:04:53 PM, Josh Kupershmidt wrote:
> >> > On Wed, Dec 12, 2012 at 8:14 AM, Karl O. Pinc <kop(at)meme(dot)com>
> wrote:
> >> > > On 12/11/2012 10:25:43 PM, Josh Kupershmidt wrote:
> >> > >> On Tue, Dec 11, 2012 at 11:46 AM, Karl O. Pinc <kop(at)meme(dot)com>
> >> > wrote:
> >> > >> >> I believe you need ellipses behind --table in the syntax
> >> > summaries
> >> > >> >> of the command reference docs.
> >>
> >>
> >> > > Yes. I see. I didn't look at all the command's reference
> pages
> >> > > but did happen to look at clusterdb, which does have --table
> >> > > in the syntax summary. I just checked and you need to fix
> >> > > clusterdb, reindexdb, and vacuumdb.
> >> >
> >> > OK, I made some changes to the command synopses for these three
> >> > commands.
> >
> >> I want the ... outside the square braces, because the --table (or
> -t)
> >> must repeat for each table specified. Like:
> >>
> >> vacuumdb [connection-option...] [option...] [ --table | -t table
> >> [( column [,...] )] ]... [dbname]
> >>
> >> reindexdb [connection-option...] [ --table | -t table ]... [
> --index
> >> |
> >>
> >> -i index ]... [dbname]
> >
> >> Have you had trouble getting this to work?
> >
> > Perhaps <arg choice="opt"><arg rep="repeat"> ... would work?
>
> Well, I fooled around with the SGML for a bit and came up with
> something which has the ellipses in brackets:
>
> [ --table | -t table ] [...]
>
> which I like a little better than not having the second set of
> brackets. New version attached.

The problem is that the pg man pages would then have a
syntax different from all the other man pages in the system,
which all have ... outside of square braces.
See "man cat", e.g.
(I wonder if the problem is because the style sheets
have been tweaked to work well with sql?)

Because I don't see the traditional man page ellipsis syntax
anywhere in the pg docs, and because all the pg
client command line programs that use repeating arguments
all have a simplified syntax summary with just [options ...]
or some such, I suspect that there may be a problem
putting the ellipsis outside of the square braces.

It would be nice if we could get some guidance from someone
more familiar with the pg docbook stylesheets.

As a fallback I'd do to the clusterdb, reindexdb, and vacuumdb
syntax summaries what was done to the pg_dump and pg_restore
syntax summaries. Remove all the detail. This is sucky,
and _still_ leaves the reference pages with a syntax summary syntax
that differs from regular man pages, but because the text
is relatively information free nobody notices.

My inclination, since you can't make it work
and we don't seem to be getting any help here,
is to remove all the detail in the syntax summaries,
push it through to a committer, and get some feedback that way.

Regards,

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein


From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multiple --table options for other commands
Date: 2012-12-14 03:24:24
Message-ID: CAK3UJRHVcBcBXjnuSC_Hu+6SZc3bHzbyoUp8XQZNQ7y0mot1wQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Dec 13, 2012 at 7:24 PM, Karl O. Pinc <kop(at)meme(dot)com> wrote:

> The problem is that the pg man pages would then have a
> syntax different from all the other man pages in the system,
> which all have ... outside of square braces.
> See "man cat", e.g.

FWIW, `man cat` on my OS X machine has synopsis:

cat [-benstuv] [file ...]

though I see:

cat [OPTION] [FILE]...

on Debian.

> (I wonder if the problem is because the style sheets
> have been tweaked to work well with sql?)
>
> Because I don't see the traditional man page ellipsis syntax
> anywhere in the pg docs, and because all the pg
> client command line programs that use repeating arguments
> all have a simplified syntax summary with just [options ...]
> or some such, I suspect that there may be a problem
> putting the ellipsis outside of the square braces.

Yeah, I tried a few different ways and didn't manage to get:
[ --table | -t table ] ...

> It would be nice if we could get some guidance from someone
> more familiar with the pg docbook stylesheets.
>
> As a fallback I'd do to the clusterdb, reindexdb, and vacuumdb
> syntax summaries what was done to the pg_dump and pg_restore
> syntax summaries. Remove all the detail. This is sucky,
> and _still_ leaves the reference pages with a syntax summary syntax
> that differs from regular man pages, but because the text
> is relatively information free nobody notices.

That should be how the v2 patch has it.

> My inclination, since you can't make it work
> and we don't seem to be getting any help here,
> is to remove all the detail in the syntax summaries,
> push it through to a committer, and get some feedback that way.

If someone out there feels that the formatting of these commands'
synopses should look like:
[ --table | -t table ] ...

and knows how to massage the SGML to get that, I'm happy to
accommodate the change. Otherwise, I think either the v4 or v2 patch
should be acceptable.

Josh


From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multiple --table options for other commands
Date: 2012-12-14 04:03:14
Message-ID: 1355457794.26124.11@mofo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 12/13/2012 09:24:24 PM, Josh Kupershmidt wrote:
> On Thu, Dec 13, 2012 at 7:24 PM, Karl O. Pinc <kop(at)meme(dot)com> wrote:

> > As a fallback I'd do to the clusterdb, reindexdb, and vacuumdb
> > syntax summaries what was done to the pg_dump and pg_restore
> > syntax summaries. Remove all the detail. This is sucky,
> > and _still_ leaves the reference pages with a syntax summary syntax
> > that differs from regular man pages, but because the text
> > is relatively information free nobody notices.
>
> That should be how the v2 patch has it.

No. The v2 patch does not touch the syntax synopsis.

>
> > My inclination, since you can't make it work
> > and we don't seem to be getting any help here,
> > is to remove all the detail in the syntax summaries,
> > push it through to a committer, and get some feedback that way.
>
> If someone out there feels that the formatting of these commands'
> synopses should look like:
> [ --table | -t table ] ...
>
> and knows how to massage the SGML to get that, I'm happy to
> accommodate the change. Otherwise, I think either the v4 or v2 patch
> should be acceptable.

My brain seems to have turned itself on. I went and (re)read
the docbook manual and was able to come up with this,
which works:

<arg choice="plain" rep="repeat"><arg choice="opt">
<group choice="plain">
<arg choice="plain"><option>--table</option></arg>
<arg choice="plain"><option>-t</option></arg>
</group>
<replaceable>table</replaceable> </arg></arg>

Yay! (indentation et-al aside)

Sorry to be so persnickety, and unhelpful until now.
It seemed like it should be doable, but something
was going wrong between keyboard and chair. I guess
I should be doing this when better rested.

Regards,

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein


From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multiple --table options for other commands
Date: 2012-12-14 05:02:56
Message-ID: CAK3UJREb68-vvyQrAWC8JDvK-2cvfrWX7CK0dH8-6W31xtGg8w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Dec 13, 2012 at 9:03 PM, Karl O. Pinc <kop(at)meme(dot)com> wrote:
> My brain seems to have turned itself on. I went and (re)read
> the docbook manual and was able to come up with this,
> which works:
>
>
> <arg choice="plain" rep="repeat"><arg choice="opt">
> <group choice="plain">
> <arg choice="plain"><option>--table</option></arg>
> <arg choice="plain"><option>-t</option></arg>
> </group>
> <replaceable>table</replaceable> </arg></arg>
>
> Yay! (indentation et-al aside)

That does seem to work, thanks for figuring out the syntax.

> Sorry to be so persnickety, and unhelpful until now.
> It seemed like it should be doable, but something
> was going wrong between keyboard and chair. I guess
> I should be doing this when better rested.

No problem, here is v5 with changed synopses.

Josh

Attachment Content-Type Size
multiple_tables.v5.diff application/octet-stream 27.6 KB

From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multiple --table options for other commands
Date: 2012-12-14 15:14:14
Message-ID: 1355498054.28556.1@mofo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 12/13/2012 11:02:56 PM, Josh Kupershmidt wrote:
> On Thu, Dec 13, 2012 at 9:03 PM, Karl O. Pinc <kop(at)meme(dot)com> wrote:

> > Sorry to be so persnickety, and unhelpful until now.
> > It seemed like it should be doable, but something
> > was going wrong between keyboard and chair. I guess
> > I should be doing this when better rested.
>
> No problem, here is v5 with changed synopses.

The clusterdb synopsis had tabs in it, which I understand
is frowned upon in the docs. I've fixed this.
It looks good to me, passes check and so forth.

Attached is a v6 patch, with no tabs in docs and based
off the latest head.

I'm marking it ready for committer.

Regards,

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

Attachment Content-Type Size
multiple_tables.v6.diff text/x-patch 21.9 KB

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
Cc: Josh Kupershmidt <schmiddy(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multiple --table options for other commands
Date: 2013-01-17 10:28:15
Message-ID: CABUevEyuqtpmRLG8WcU1iBabDSPXCg3aCFSQwMpU+bg5BMcFKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Dec 14, 2012 at 4:14 PM, Karl O. Pinc <kop(at)meme(dot)com> wrote:
> On 12/13/2012 11:02:56 PM, Josh Kupershmidt wrote:
>> On Thu, Dec 13, 2012 at 9:03 PM, Karl O. Pinc <kop(at)meme(dot)com> wrote:
>
>> > Sorry to be so persnickety, and unhelpful until now.
>> > It seemed like it should be doable, but something
>> > was going wrong between keyboard and chair. I guess
>> > I should be doing this when better rested.
>>
>> No problem, here is v5 with changed synopses.
>
> The clusterdb synopsis had tabs in it, which I understand
> is frowned upon in the docs. I've fixed this.
> It looks good to me, passes check and so forth.
>
> Attached is a v6 patch, with no tabs in docs and based
> off the latest head.
>
> I'm marking it ready for committer.

Thanks. Applied, with only some small whitespace changes.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/