Thread: Catching errors
Is it possible to "catch" errors in pl/pgsql? For example, instead of the function exiting with (from an INSERT attempt): ERROR: duplicate key violates unique constraint "user_name" CONTEXT: PL/pgSQL function "add_user" line 12 at SQL statement The function could catch the error, then generate it's own custom error message: raise exception ''user name already exists''; Thanks, CSN __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail
On Wed, Jun 23, 2004 at 03:54:25PM -0700, CSN wrote: > Is it possible to "catch" errors in pl/pgsql? For > example, instead of the function exiting with (from an > INSERT attempt): > > ERROR: duplicate key violates unique constraint > "user_name" No :-( -- Alvaro Herrera (<alvherre[a]dcc.uchile.cl>) Tulio: oh, para qué servirá este boton, Juan Carlos? Policarpo: No, aléjense, no toquen la consola! Juan Carlos: Lo apretaré una y otra vez.