Subject error handling
Author Ulrich

I would like to handle possible exceptions inside the database. For
example an invalid value for a primary index. My question is where can
I handle the exception 335544665 unique_key_violation? Is it possible
at all?

Actually I'm testing the value for the primary key inside the 'before
insert' trigger with some PSQL code. But the code for testing the
value runs on every insert. Is it possible to do it only when an
exception raises?

Inside the 'before' triggers the exception will not raise. Inside the
'after' triggers its too late(?)

With best regards - Ulrich