Re: US Telephone Number Type

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: US Telephone Number Type
Дата
Msg-id 24142.1152560303@sss.pgh.pa.us
обсуждение исходный текст
Ответ на US Telephone Number Type  ("Karen Hill" <karen_hill22@yahoo.com>)
Ответы Re: US Telephone Number Type  ("Karen Hill" <karen_hill22@yahoo.com>)
Список pgsql-general
"Karen Hill" <karen_hill22@yahoo.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Vivek Khera
Дата:
Сообщение: Re: US Telephone Number Type
Следующее
От: Karsten Hilbert
Дата:
Сообщение: timestamp with definable accuracy, was: Re: empty text fields