Re: Distinct types

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Distinct types
Дата
Msg-id 200811290026.13837.peter_e@gmx.net
обсуждение исходный текст
Ответ на Re: Distinct types  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Distinct types  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
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.


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Fixing contrib/isn for float8-pass-by-value
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Distinct types