psql script error handling - Mailing list pgsql-general

From James Neff
Subject psql script error handling
Date
Msg-id 4595B0F8.7060508@tethyshealth.com
Whole thread Raw
Responses Re: psql script error handling  (Michael Fuhr <mike@fuhr.org>)
List pgsql-general
I have an sql script that I am trying to execute in psql client on the
database itself.  The script is just a bunch (hundreds of thousands) of
INSERT statements.

I don't know how, but I seem to have bad characters throughout my file
and when I run the script it will of course error out complaining about
the invalid character.  I figure out how many insert statements were
successful and use sed to chop of those statements from the sql script
file.  I then use VI and delete out the bad character and re-run the
script.

There's got to be a better way to do this.  Is there a way in a psql
script to try to execute the INSERT statement and if theres a problem to
dump it to a log file and go on with the others?

Thanks in advance,
James

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Autovacuum Improvements
Next
From: Ben
Date:
Subject: Re: Geographical redundancy