From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Karen Hill" <karen_hill22(at)yahoo(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: US Telephone Number Type |
Date: | 2006-07-10 19:38:23 |
Message-ID: | 24142.1152560303@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Karen Hill" <karen_hill22(at)yahoo(dot)com> writes:
> How would one go about creating a US telephone type in the format of
> "(555)-555-5555" ?
Are you sure that's what you want? Even within the US there's the issue
of extension numbers; I'm not sure how useful it is to have a datatype
that refuses anything but the basic 10-digit format.
It doesn't seem particularly hard to make a type that stores just the
digits (applying whatever amount of error-checking seems appropriate
on the non-digit stuff it's throwing away) and on output regurgitates
a standardized format. Minimum support would just be an input function
and an output function, and it doesn't seem like you need too many other
functions besides them ... do you need indexing support?
> Should the telephone type be able to do something such as:
> SELECT * from tableFOO where telephone.areacode = 555;
It'd be syntactically easier as a function:
areacode(telephone) = 555
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Broersma Jr | 2006-07-10 19:46:31 | Re: US Telephone Number Type |
Previous Message | Steve Atkins | 2006-07-10 19:35:02 | Re: US Telephone Number Type |