Skip site navigation (1) Skip section navigation (2)

Re: Variable-length Types

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: sqllist <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Variable-length Types
Date: 2000-10-15 20:36:31
Message-ID: 39EA154F.A5D9C9A2@agliodbs.com (view raw or flat)
Thread:
Lists: pgsql-sql
Tom,

> However, building a new type for this seems like overkill, because you'd
> also have to supply a set of functions and operators for the type.  It
> would be a lot less work just to provide a normalization function
>         interpret_phone_no(text) returns text
> which could be invoked explicitly, eg
>         insert into tab values (..., interpret_phone_no('5551212'), ...)
> or implicitly in ON INSERT and ON UPDATE triggers for the table.

Thanks.  You're probably right ... reformatting the phone numbers is
going to be a lot less work than a custom type.  Still, I can see the
usefulness of a custom type if one had the time to build the new library
of operators etc. For example, a special set of comparison operators for
phone numbers.   Maybe I'll hire somebody to do it :-)

I do think I'll use triggers for ON INSERT and ON UPDATE, because it
will space me having to remember to use the function every time I handle
a phone number field.  I'll post the PLSQL function after I've written
it.

-Josh Berkus


-- 
______AGLIO DATABASE SOLUTIONS___________________________
                                        Josh Berkus
   Complete information technology      josh(at)agliodbs(dot)com
    and data management solutions       (415) 436-9166
   for law firms, small businesses       fax  436-0137
    and non-profit organizations.       pager 338-4078
                        		San Francisco

In response to

Responses

pgsql-sql by date

Next:From: Itai ZukermanDate: 2000-10-15 20:58:05
Subject: Re: Variable-length Types
Previous:From: Tom LaneDate: 2000-10-15 20:26:24
Subject: Re: Variable-length Types

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group