Re: psql output and password Qs

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: ow <oneway_111(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: psql output and password Qs
Date: 2003-09-19 20:56:00
Message-ID: 1064004960.5362.3.camel@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, 2003-09-19 at 19:47, ow wrote:
> Hi,
>
> 1) When psql is run from a script, how would one save *all* output generated by
> psql (including errors, info messages, etc) in to a file?. I tried redirecting
> output with ">" but that did not save error/confirmation messages.

Standard output and standard error are different streams.

The normal way to do what you want (Bourne shell syntax) is:

psql ... >outfile 2>&1

> 2) When psql is run from a script, how would one pass a password to psql?

Create a .pgpass file to read it from (see the manual for details).

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"Bring ye all the tithes into the storehouse, that
there may be meat in mine house, and prove me now
herewith, saith the LORD of hosts, if I will not open
you the windows of heaven, and pour you out a
blessing, that there shall not be room enough to
receive it." Malachi 3:10

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Paul Thomas 2003-09-19 22:14:54 Re: virus warning
Previous Message ow 2003-09-19 18:47:16 psql output and password Qs