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 3183114B27F6 for ; Mon, 9 Aug 2004 14:37:20 -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 01663-07 for ; Mon, 9 Aug 2004 17:37:18 +0000 (GMT) Received: from main.base.ro (main.base.ro [213.154.110.30]) by svr1.postgresql.org (Postfix) with ESMTP id E3C5614B2868 for ; Mon, 9 Aug 2004 14:37:16 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by main.base.ro (Postfix) with ESMTP id 54483119AD8; Mon, 9 Aug 2004 20:41:42 +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 06285-34; Mon, 9 Aug 2004 20:41:41 +0300 (EEST) Received: from [192.168.3.104] (obsd.base.ro [192.168.3.1]) by main.base.ro (Postfix) with ESMTP id DF04B119AD6; Mon, 9 Aug 2004 20:41:41 +0300 (EEST) Message-ID: <4117B69C.8080104@base.ro> Date: Mon, 09 Aug 2004 20:38:36 +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: Tom Lane Cc: pgsql-sql@postgresql.org Subject: Re: Exception handling from trigger References: <4117AA90.9080704@base.ro> <16661.1092071643@sss.pgh.pa.us> In-Reply-To: <16661.1092071643@sss.pgh.pa.us> X-Enigmail-Version: 0.84.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; 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/66 X-Sequence-Number: 18563 Tom Lane wrote: >You can't. From a logical perspective this is sensible, because the >trigger is handed data already formed into a tuple. If the presented >tuple contained a mycolumn value wider than 64 characters then it would >not be a legal value of the rowtype (any more than if, say, the column >value were an integer and not a varchar at all). > >What I'd suggest if you want this is to remove the datatype restriction >and instead rely on your trigger to enforce the limitation. > > > I just realised that. I would design those columns as text and enforce value length restrictions with triggers. It's a false problem: I define the data type for a field and want to check his value after the exception that I can't fit larger data into my field. Thank you, Rod, Tom ....