Re: Tidying values on variable instantiation - Mailing list pgsql-sql

From Russell Simpkins
Subject Re: Tidying values on variable instantiation
Date
Msg-id BAY103-DAV54933189A33A8FFB349D2B5AA0@phx.gbl
Whole thread Raw
In response to Tidying values on variable instantiation  ("Bath, David" <dave.bath@unix.net>)
List pgsql-sql
> 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.


pgsql-sql by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: Tidying values on variable instantiation
Next
From: "Greg Patnude"
Date:
Subject: Re: Tidying values on variable instantiation