Re: confusing archive_command example - Mailing list pgsql-docs

From Greg Smith
Subject Re: confusing archive_command example
Date
Msg-id 4BB48EE1.2050303@2ndquadrant.com
Whole thread Raw
In response to Re: confusing archive_command example  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: confusing archive_command example
List pgsql-docs
Peter Eisentraut wrote:
> On ons, 2010-03-31 at 19:51 -0400, Bruce Momjian wrote:
>
>> Also, should we be using test ! -e instead of -f?
>>
>
> test -e is not portable.
>

Right; there are plenty of shells where "test -e" isn't implemented, I
believe some Solaris and/or HP-UX systems have that issue.  The original
"test -f" was already the best example to give here.

As for the update Josh suggested, there are two issues here.  The PITR
documentation at
http://developer.postgresql.org/pgdocs/postgres/continuous-archiving.html
starts with this example:

archive_command = 'cp -i %p /mnt/server/archivedir/%f </dev/null'

And then it used to show this one (now it has 'test -e'):

archive_command = 'test ! -f .../%f && cp %p .../%f'

I agree this is confusing.  That second line should just read like this
to match the other examples:

archive_command = 'test ! -f /mnt/server/archivedir/%f && cp %p
/mnt/server/archivedir/%f'

And to revert the "test -e" change.

The third issue here, not mentioned yet, is that there's also an example
of setting up archive_command in its GUC documentation:

http://developer.postgresql.org/pgdocs/postgres/runtime-config-wal.html

This has drifted out of sync with the section being updated here this
week--its archive_command example isn't even using "-i".  I think the
right thing to do here is to migrate the Windows example out of 18.5.3
from 24.3.1, then replace the existing examples in 18.5.3 to instead
suggest 24.3.1 has them.  Given that all of this documentation giving
examples for how to correctly configure that parameter, like this cp
trivia, only appears in the PITR docs section, I don't see any reason to
duplicate that in the GUC area.  Having the second, minimally documented
version of those in 18.5.3 just encourages people to use what we know is
a bad practice by providing them as examples.

--
Greg Smith  2ndQuadrant US  Baltimore, MD
PostgreSQL Training, Services and Support
greg@2ndQuadrant.com   www.2ndQuadrant.us


pgsql-docs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: confusing archive_command example
Next
From: Heikki Linnakangas
Date:
Subject: Re: [HACKERS] Streaming replication document improvements