From: | Raymond O'Donnell <rod(at)iol(dot)ie> |
---|---|
To: | Tom Hart <tomhart(at)coopfed(dot)org> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: insert continue on error |
Date: | 2007-10-16 21:44:44 |
Message-ID: | 471530CC.40108@iol.ie |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 16/10/2007 20:37, Tom Hart wrote:
> What I'd like to know is if there's a way to have postgresql still
> insert the other rows, and either bounce the bad row to another table,
> or log the error in another table/file. I'm sure there's a way to do
> this, but I'm still pretty new to postgresql.
If you do the insertions within a pl/pgsql function, you can use an
EXCEPTION block to handle the error whatever way you like - have a look
here:
http://www.postgresql.org/docs/8.2/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING
There are a couple of useful examples.
HTH,
Ray.
---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod(at)iol(dot)ie
---------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2007-10-16 21:47:16 | Re: need help with rebuilding postgresql |
Previous Message | Chris Browne | 2007-10-16 21:42:10 | Re: improvement proposition |