X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2FC3114B2806 for ; Mon, 9 Aug 2004 13:45:58 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82221-10 for ; Mon, 9 Aug 2004 16:45:55 +0000 (GMT) Received: from main.base.ro (main.base.ro [213.154.110.30]) by svr1.postgresql.org (Postfix) with ESMTP id 9840214B27FF for ; Mon, 9 Aug 2004 13:45:53 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by main.base.ro (Postfix) with ESMTP id 2CD84119AC4; Mon, 9 Aug 2004 19:50:17 +0300 (EEST) Received: from main.base.ro ([127.0.0.1]) by localhost (saliut [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 06284-25; Mon, 9 Aug 2004 19:50:16 +0300 (EEST) Received: from [192.168.3.104] (obsd.base.ro [192.168.3.1]) by main.base.ro (Postfix) with ESMTP id E2CEE119AC2 for ; Mon, 9 Aug 2004 19:50:16 +0300 (EEST) Message-ID: <4117AA90.9080704@base.ro> Date: Mon, 09 Aug 2004 19:47:12 +0300 From: Vlad Dimitriu Organization: Base Consulting User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040623 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Exception handling from trigger X-Enigmail-Version: 0.84.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by Postfix_Antivirus at base.ro X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/62 X-Sequence-Number: 18559 Hello, I would like to handle the exceptions that a database returns. For example, if a "mycolumn" column is defined as varchar(64), I'd like to catch if the new.mycolumn is larger than 64 with my own trigger (for cutoms, internationalized messages, etc ..). So I did, but the database catch this error before my 'before insert'-trigger (using character_length(new.mycolumn) ...). Is this way of handling exceptions possible in postgres ? If so, what is the normal way to handle this exceptions, from a plpgsql/trigger(rule??) perspective ? Thank you ... Vlad Dimitriu