pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: sqllist <pgsql-sql@postgresql.org>
Subject: Re: Variable-length Types
Date: Sun, 15 Oct 2000 13:36:31 -0700
Message-ID: <39EA154F.A5D9C9A2@agliodbs.com> (raw)
References: <871yxi432t.fsf@matt.w80.math-hat.com>
	<39E9F80C.D9BE2054@agliodbs.com>
	<5470.971641584@sss.pgh.pa.us>

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



view thread (10+ messages)  latest in thread

Message-ID: <39EA154F.A5D9C9A2@agliodbs.com>
Permalink:  ../39EA154F.A5D9C9A2@agliodbs.com/
Also on:    postgresql.org/message-id/39EA154F.A5D9C9A2@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com
  Subject: Re: Variable-length Types
  In-Reply-To: <39EA154F.A5D9C9A2@agliodbs.com>
  References: <871yxi432t.fsf@matt.w80.math-hat.com> <39E9F80C.D9BE2054@agliodbs.com> <5470.971641584@sss.pgh.pa.us> <39EA154F.A5D9C9A2@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox