> Hello > > you have to parse a sqlerrm variable That's one way to do that. Another - more complex but more correct in many cases is using two separate blocks. BEGIN ... do stuff involving constraint A EXCEPTION WHEN unique_violation THEN ... END; BEGIN ... do stuff involving constraint B EXCEPTION WHEN unique_violation THEN ... END; But that's not possible if there are two unique constraints involved in a single SQL statement (e.g. inserting into a table with two unique constraints). regards Tomas -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general