X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 79A3B14B2804 for ; Thu, 12 Aug 2004 12:09:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38530-06 for ; Thu, 12 Aug 2004 15:09:25 +0000 (GMT) Received: from anchor-post-32.mail.demon.net (anchor-post-32.mail.demon.net [194.217.242.90]) by svr1.postgresql.org (Postfix) with ESMTP id 797E314B27FC for ; Thu, 12 Aug 2004 12:09:24 -0300 (ADT) Received: from mailgate.bray-healthcare.com ([80.177.250.202] helo=solport.bray-healthcare.com) by anchor-post-32.mail.demon.net with esmtp (Exim 3.35 #1) id 1BvHCk-000KaE-0W; Thu, 12 Aug 2004 15:09:22 +0000 Received: from braydb.bray-healthcare.com ([192.168.1.18]) by solport.bray-healthcare.com with esmtp (Exim 3.36 #1 (Debian)) id 1BvHCj-0007jx-00; Thu, 12 Aug 2004 16:09:21 +0100 Subject: Re: Sending errors from psql to error file From: Oliver Elphick Reply-To: olly@lfix.co.uk To: devin@synapticvision.com Cc: pgsql-sql@postgresql.org In-Reply-To: <1092322881.23985.38.camel@192.168.1.80> References: <1092320416.23985.24.camel@192.168.1.80> <1092322233.11188.30.camel@braydb> <1092322881.23985.38.camel@192.168.1.80> Content-Type: text/plain Message-Id: <1092323361.11184.34.camel@braydb> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Thu, 12 Aug 2004 16:09:21 +0100 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/117 X-Sequence-Number: 18614 On Thu, 2004-08-12 at 16:01, Devin Whalen wrote: > > zcat cli_postDataInserts.sql.gz | > > psql -d cli_post -U system --echo-queries -f - >trace.file 2>&1 > > Just a few questions about your command. I tried it with one sql > statement that I know doesn't work and the error went into the right > file. However, I would like to know WHY it works...hope you don't mind > shedding some light on it :). Specifically, the - >trace.file 2>&1 > part. I know...well actually think, that the > is redirecting the ouput to the trace.file. But what the hell is 2>&1 doing?? > Also, the - ...it kinda just looks like a stray dash to me....although I know it must be doing something ;). > Will this put all output? Or just the errors. ">" redirects standard output "2>" redirects standard error Your command did not redirect standard error, so the errors didn't get to grep The syntax for -f is "-f filename"; the filename "-" means standard input. (Check the man page for psql!) Oliver