Sending errors from psql to error file

Devin Whalen devin-Gq53QDLGkWIleAitJ8REmdBPR1lH4CV8 at public.gmane.org
Thu Aug 12 15:03:49 UTC 2004


On Thu, 2004-08-12 at 10:24, Devin Whalen wrote:
> Hey,
> 
> I am trying to migrate a client from one database to another.  Basically
> we designed a web application for them using PostgreSQL but we have made
> many changes to the design of our application since version 1.  Now they
> want to upgrade to our new version.  So basically I have to pg_dump
> their current data and then import it into our new schema.  Now, of
> course I realize that there are going to be errors.  But they have a lot
> and I mean a LOT of data.  I don't want to have to sit there and watch
> the import go by and monitor every insert, I want to run a command and
> then look in a file for any errors after the import is complete.  I
> tried this command but it didn't work:
> 
> gunzip -c dataInserts.sql.gz | psql dbname -U username | grep "ERROR:*"
> > import_errors
> 
> (obviously dbname and username have been change to protect the innocent
> ;))
> 
> Any help is appreciated.
> 
> Thanks.

I actually found something that works.  Just in case anyone comes across
this themselves...

zcat test.sql.gz | psql -d dbname -U username --echo-queries -f -
>import_errors 2>&1

Later


-- 
Devin Whalen
Programmer
Synaptic Vision Inc
Phone-(416) 539-0801
Fax- (416) 539-8280
1179A King St. West
Toronto, Ontario
Suite 309 M6K 3C5
Home-(416) 653-3982
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list