On 10 Jul 2006 10:33:52 -0700, Karen Hill <karen_hill22@xxxxxxxxx> wrote:
Hello, How would one go about creating a US telephone type in the format of "(555)-555-5555" ? I am at a loss on how it could be accomplished in the most correct way possible while not going into the various different country styles e.g. +01 (555) 555-5555. Is the difficulty of creating a telephone type the reason it is not in postgresql already?
if it was me, i would keep a telephone type to simple text field. while there is some merit to throwing a domain constraint on it, history tells me this is more troulbe than it's worth :). otoh, you could make a small immutable sql based regex function to attempt to extract the area code or some other number from the text field. You could then index this if desired. merlin