error handling. How to? - Mailing list pgsql-general

From Janning Vygen
Subject error handling. How to?
Date
Msg-id 01070910035506.30460@janning
Whole thread Raw
List pgsql-general
Hi,

i try do achieve that my database checks every entry on insert and update and
returns german error messages, so my frontend knows what's wrong and can show
some reasonable error messages to the user.

i wrote a trigger who checks BEFORE every insert and updtae and returns error
messages if new values are not acceptable.

one of my problems:
if i have a value like bool or int2 and the frontend is html and just takes
the input from a textfield, the backend returns an error before executing the
trigger beacuse the values cant be parsed into the correct type.

But should not the trigger be called BEFORE inserting?
It seems not, maybe just because the NEW record has to be filled and with a
mismatching type it can't be done!?

Bad thing about it: my trigger should report every error. but it is never
executed when the type parsing fails.

I just dont want to put any error handling code in my frontend. I just want
the backend to return something like
"ERROR: errormessage1; ERROR: errormessage2;"
to return all errors on all fields.

Can anybody tell me how to make a really good and flexible error processing
with postgreSQL??

janning

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: inserting columns with values from a different table
Next
From: "Fabrizio Mazzoni"
Date:
Subject: problems with rules and views