Re: trapping errors

From: "Selena Deckelmann" <selenamarie(at)gmail(dot)com>
To: "Thomas Keller" <kellert(at)ohsu(dot)edu>
Cc: "Postgresql PDX_Users" <pdxpug(at)postgresql(dot)org>
Subject: Re: trapping errors
Date: 2008-10-01 23:46:33
Message-ID: 2b5e566d0810011646u1d1bb652paddb7629c520d68e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pdxpug

On Wed, Oct 1, 2008 at 3:41 PM, Thomas Keller <kellert(at)ohsu(dot)edu> wrote:

> Hi,I've got a rather complicated csv file whose records I'd like to insert
> into a table. I've got most of the records whipped into shape, but there are
> a handful that are still getting skipped.
>
> How do I trap them using psql?
> That is, I use perl to parse the file and create an insert.sql file. I use
> psql with \i to read the file. I'd like to somehow capture the messages for
> the records that don't get successfully inserted.
>

You could run this from a terminal session:

$ psql -f insert.sql 2>&1 >log.txt

$ psql -f insert.sql 2>&1 | tee -f log.txt

if you want to see the errors as they happen...

-selena

--
Selena Deckelmann
PDXPUG - http://pugs.postgresql.org/pdx
Me - http://www.chesnok.com/daily

In response to

Browse pdxpug by date

  From Date Subject
Next Message Selena Deckelmann 2008-10-02 13:36:33 October meeting - change of plans
Previous Message Selena Deckelmann 2008-10-01 22:51:25 October 16 Meeting! Randal + Smalltalk