X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D30BCD79AF for ; Fri, 26 Aug 2005 09:55:22 -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 74248-03 for ; Fri, 26 Aug 2005 12:55:14 +0000 (GMT) Received: from hotmail.com (bay103-dav5.bay103.hotmail.com [65.54.174.77]) by svr1.postgresql.org (Postfix) with ESMTP id D7E71D7066 for ; Fri, 26 Aug 2005 09:55:13 -0300 (ADT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 26 Aug 2005 05:55:17 -0700 Message-ID: Received: from 65.54.174.200 by BAY103-DAV5.phx.gbl with DAV; Fri, 26 Aug 2005 12:55:17 +0000 X-Originating-IP: [65.54.174.200] X-Originating-Email: [russellsimpkins@hotmail.com] X-Sender: russellsimpkins@hotmail.com From: "Russell Simpkins" To: , References: <200508261304.10542.dave.bath@unix.net> Subject: Re: Tidying values on variable instantiation Date: Fri, 26 Aug 2005 08:55:30 -0400 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-OriginalArrivalTime: 26 Aug 2005 12:55:17.0320 (UTC) FILETIME=[6884FC80:01C5AA3D] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=3.291 required=5 tests=[AWL=-1.496, DNS_FROM_RFC_ABUSE=0.374, DNS_FROM_RFC_POST=1.376, FORGED_MUA_OUTLOOK=3.037, MSGID_FROM_MTA_HEADER=0] X-Spam-Level: *** X-Archive-Number: 200508/246 X-Sequence-Number: 22474 > Desired Outcome(s): > * I would like to have the convenience of declaring a column that obeys > a constraint (similar to using a domain), but allows a "tidy-up" as the > value is created BEFORE asserting the constraint. This *might* be > termed a "domain trigger". (Perhaps even a WORM is possible!). > * I would like to able to declare columns as > "trimmed_varchar(n)". > * I'd like to be able to use the same approach for other "weak domains". I'm not sure these any easier way to do this than with tirggers. If the daunting task would writing a large number of triggers, I would write sql or php to generate all the triggers. Remember that you can introspect the db using the system catalogs. I've had a lot of good results generating triggers and sql using Middlegen and Velocity.