On Friday 28 November 2008 18:49:17 Tom Lane wrote:
> > * Strong typing is preferable in complex applications to avoid errors
> > like sum(ordinal_column). Most developers use this all the time in their
> > 3GL code but cannot use it in SQL.
>
> The problem I see with distinct types is that the typing is *too*
> strong --- the datatype has in fact got no usable operations whatever.
You are supposed to define your own. It's a new type after all. You only
borrow the representation from an existing one.
Random example, maybe not the best one: When you create an email type based on
text, you don't really want to carry the || operator along, because email ||
email is not an email (usually). The same applies to substring and pretty
much everything else. Domains are not the best solution if you want type
safety.