pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Elphick <olly@lfix.co.uk>
To: devin@synapticvision.com
Cc: pgsql-sql@postgresql.org
Subject: Re: Sending errors from psql to error file
Date: Thu, 12 Aug 2004 16:09:21 +0100
Message-ID: <1092323361.11184.34.camel@braydb> (raw)
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>

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




view thread (7+ messages)  latest in thread

Message-ID: <1092323361.11184.34.camel@braydb>
Permalink:  ../1092323361.11184.34.camel@braydb/
Also on:    postgresql.org/message-id/1092323361.11184.34.camel@braydb

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: olly@lfix.co.uk, devin@synapticvision.com
  Subject: Re: Sending errors from psql to error file
  In-Reply-To: <1092323361.11184.34.camel@braydb>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox