Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by hub.org (8.10.1/8.10.1) with ESMTP id e9FKaTR93054 for ; Sun, 15 Oct 2000 16:36:29 -0400 (EDT) Received: from [63.195.55.98] (HELO agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.3) with ESMTP id 1100108 for pgsql-sql@postgresql.org; Sun, 15 Oct 2000 13:36:28 -0700 Message-ID: <39EA154F.A5D9C9A2@agliodbs.com> Date: Sun, 15 Oct 2000 13:36:31 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions X-Mailer: Mozilla 4.73 [en] (Win98; I) X-Accept-Language: en MIME-Version: 1.0 To: sqllist Subject: Re: Variable-length Types References: <871yxi432t.fsf@matt.w80.math-hat.com> <39E9F80C.D9BE2054@agliodbs.com> <5470.971641584@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200010/134 X-Sequence-Number: 1796 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@agliodbs.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