Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

psql script error handling



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



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group