psql script error handling

Поиск
Список
Период
Сортировка
От James Neff
Тема psql script error handling
Дата
Msg-id 4595B0F8.7060508@tethyshealth.com
обсуждение исходный текст
Ответы Re: psql script error handling  (Michael Fuhr <mike@fuhr.org>)
Список 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 по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Autovacuum Improvements
Следующее
От: Ben
Дата:
Сообщение: Re: Geographical redundancy