[DOCS] coalesce

2011-09-21 Thread Henry Drexler
http://www.postgresql.org/docs/9.1/static/functions-conditional.html

states:  "The COALESCE function returns the first of its arguments that is
not null. Null is returned only if all arguments are null."

I was having a terrible time understanding this, and looking at the two
examples were just as confusing I could not get it to work right.

not sure if others have had the same difficulty, but here are my suggested
adjustments:


Then on someones website this made perfect sense to me:
 " If the results of the first argument are null, it will return the
second."

so I made this example that makes sense:

COALESCE(column,substitute value)


[DOCS] Documentation 9.1 - can't be searched

2011-09-21 Thread Stefan Wolf
www.postgresql.org/docs/9.1/static/index.html

 

"Your search for XX returned no hits"

 

Regards Stefan Wolf



 



Re: [DOCS] somewhat wrong archive_command example

2011-09-21 Thread Peter Eisentraut
On tis, 2011-09-20 at 22:45 -0400, Greg Smith wrote:
> Attached is a working local_backup_script.sh that does the same basic 
> thing as the "Standalone Hot Backups" example.  It includes lots of 
> error checking, useful messages when it doesn't work like this:
> 
> Archive directory does not exist
> LOG:  archive command failed with exit code 1
> DETAIL:  The failed archive command was: ./local_backup_script.sh 
> pg_xlog/00010001007D 00010001007D
> 
> And it takes advantage of the fact that scripts will be executed in 
> $PGDATA, by putting all the paths it uses relative to it.
> 
> If I could get some general agreement this is a good direction to
> wander 
> in, I'd be happy to wrap this into a full doc patch and submit it.
> I've 
> been meaning to do this for a while and just never got around to it. 

I can see a few problems with your script, as far as making it into a
generally reusable example:

- Uses bash.  Portable scripts shouldn't do this.

- Overwrites PATH variable for unrelated purpose.

- Path ($PATH) should be quoted everywhere.  (By contrast, you don't
need the quotes in PATH="$1".  Just saying ...)

- cp shouldn't be called with an absolute path.

I guess this only supports the point that even a small script can
contain lots of traps, so providing a robust example would be helpful.



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


Re: [DOCS] coalesce

2011-09-21 Thread Kevin Grittner
Henry Drexler  wrote:
 
> "If the results of the first argument are null, it will return the
> second."
 
Unless the second is also null, in which case it will return the
third.  Unless the third is also null...
 
The trick is to come up with language which recognizes that there
can be any number of arguments.  Personally, I think the existing
language does a good job of that, and is pretty clear.
 
> so I made this example that makes sense:
> 
> COALESCE(column,substitute value)
 
Perhaps a two-argument example would be helpful, as long as it
doesn't mislead people into thinking the construct is limited to two
arguments.
 
-Kevin

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


Re: [DOCS] coalesce

2011-09-21 Thread Henry Drexler
thanks,

so I take it I am not getting those more complex examples (that are
apparently beyond my use case), I will take a look at them again.

Thank you for the feedback.

On Wed, Sep 21, 2011 at 10:33 AM, Kevin Grittner <
kevin.gritt...@wicourts.gov> wrote:

> Henry Drexler  wrote:
>
> > "If the results of the first argument are null, it will return the
> > second."
>
> Unless the second is also null, in which case it will return the
> third.  Unless the third is also null...
>
> The trick is to come up with language which recognizes that there
> can be any number of arguments.  Personally, I think the existing
> language does a good job of that, and is pretty clear.
>
> > so I made this example that makes sense:
> >
> > COALESCE(column,substitute value)
>
> Perhaps a two-argument example would be helpful, as long as it
> doesn't mislead people into thinking the construct is limited to two
> arguments.
>
> -Kevin
>


Re: [DOCS] coalesce

2011-09-21 Thread Alvaro Herrera

Excerpts from Henry Drexler's message of mié sep 21 12:50:18 -0300 2011:
> thanks,
> 
> so I take it I am not getting those more complex examples (that are
> apparently beyond my use case), I will take a look at them again.

Maybe the fix is just to add a simpler example, without altering the
wording (which seems pretty clear to me as well, but then I already know
what COALESCE does).

-- 
Álvaro Herrera 
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

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


Re: [DOCS] Documentation 9.1 - can't be searched

2011-09-21 Thread Magnus Hagander
On Wed, Sep 21, 2011 at 13:52, Stefan Wolf  wrote:
> www.postgresql.org/docs/9.1/static/index.html
>
>
>
> „Your search for XX returned no hits“

Fixed, thanks for reporting it!


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

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


Re: [DOCS] somewhat wrong archive_command example

2011-09-21 Thread Greg Smith

On 09/21/2011 09:58 AM, Peter Eisentraut wrote:

I can see a few problems with your script, as far as making it into a
generally reusable example:

- Uses bash.  Portable scripts shouldn't do this.

- Overwrites PATH variable for unrelated purpose.

- Path ($PATH) should be quoted everywhere.  (By contrast, you don't
need the quotes in PATH="$1".  Just saying ...)

- cp shouldn't be called with an absolute path.
   


Most of these problems stemmed from the unnoticed fact that I'd made 
PATH the name of my variable.  The absolute path for cp for example?  
Added that because it couldn't seem to find cp in the PATH, which was 
driving me crazy for a while there...sigh.


Attached version fixes the late night brain fade errors.  I think the 
right thing to do next is to package this up into a doc update that 
corrects the errors in that section too; just clean the whole thing up 
while I'm poking at it.  I'll submit that over to the hackers list so 
that everyone can take a shot at correcting my shell code.


--
Greg Smith   2ndQuadrant USg...@2ndquadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support  www.2ndQuadrant.us



local_backup_script.sh
Description: Bourne shell script

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


Re: [DOCS] somewhat wrong archive_command example

2011-09-21 Thread Euler Taveira de Oliveira

On 21-09-2011 20:02, Greg Smith wrote:

Attached version fixes the late night brain fade errors. I think the right
thing to do next is to package this up into a doc update that corrects the
errors in that section too; just clean the whole thing up while I'm poking at
it. I'll submit that over to the hackers list so that everyone can take a shot
at correcting my shell code.


Just a few comments:

(i) full path for ARCHIVE (say /path/to/archive) and backup_in_progress. 
Absolute paths are easier to check than relative ones;
(ii) is echo with unquoted string portable? I don't know but it confuses 
readability.



--
   Euler Taveira de Oliveira - Timbira   http://www.timbira.com.br/
   PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento

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