Re: Variable-length Types
От | Josh Berkus |
---|---|
Тема | Re: Variable-length Types |
Дата | |
Msg-id | 39EA154F.A5D9C9A2@agliodbs.com обсуждение исходный текст |
Ответ на | Variable-length Types (Itai Zukerman <zukerman@math-hat.com>) |
Список | pgsql-sql |
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 informationtechnology 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
В списке pgsql-sql по дате отправления: