X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id F0376D1B515 for ; Fri, 19 Sep 2003 20:55:56 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 56505-01 for ; Fri, 19 Sep 2003 17:55:47 -0300 (ADT) Received: from anchor-post-30.mail.demon.net (anchor-post-30.mail.demon.net [194.217.242.88]) by svr1.postgresql.org (Postfix) with ESMTP id BB0A1D1B54C for ; Fri, 19 Sep 2003 17:55:44 -0300 (ADT) Received: from lfix.demon.co.uk ([80.177.205.209] helo=cerberus.lfix.co.uk) by anchor-post-30.mail.demon.net with esmtp (Exim 3.35 #1) id 1A0SI6-0007AT-0U; Fri, 19 Sep 2003 21:55:46 +0100 Received: from linda.lfix.co.uk ([192.168.1.1]) by cerberus.lfix.co.uk with esmtp (Exim 4.22) id 1A0SHr-0001oC-O1; Fri, 19 Sep 2003 21:55:31 +0100 Subject: Re: psql output and password Qs From: Oliver Elphick To: ow Cc: pgsql-sql@postgresql.org In-Reply-To: <20030919184716.51818.qmail@web21402.mail.yahoo.com> References: <20030919184716.51818.qmail@web21402.mail.yahoo.com> Content-Type: text/plain Organization: LFIX Limited Message-Id: <1064004960.5362.3.camel@linda.lfix.co.uk> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Fri, 19 Sep 2003 21:56:00 +0100 Content-Transfer-Encoding: 7bit X-LFIX-MailScanner: Found to be clean X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/208 X-Sequence-Number: 15186 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.Elphick@lfix.co.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