Re: Distinct types

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: Distinct types
Дата
Msg-id 1226044302.1432.107.camel@jdavis
обсуждение исходный текст
Ответ на Distinct types  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
On Fri, 2008-10-31 at 16:03 +0200, Peter Eisentraut wrote:
> Here is an implementation of distinct types, known from SQL99 and
> beyond.  They are like domains, except that they don't have defaults or
> constraints and they do not allow implicit casting to their base type.
> The latter aspect is what makes them distinct types.  They are useful to
> create more type-safe database schemas, to prevent using generic types
> such as text or int for everything and then mixing them in inappropriate
> ways.  This is something domains are not useful for.  Much of the
> internals are shared with domains nevertheless.  The difference is
> really only the casting behavior.
>
> To create a distinct type, just run
>
> CREATE TYPE mystring AS text;
>

It needs documentation, and I included a quick patch for that (if that's
helpful).

It builds fine for me and appears to do everything as advertised.

I skimmed the code and the relevant parts of the SQL standard, but it
may need further review by someone who knows the type system and the SQL
standard better than I.

Regards,
    Jeff Davis





Вложения

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

Предыдущее
От: "Brendan Jurd"
Дата:
Сообщение: Re: Patch for ISO-8601-Interval Input and output.
Следующее
От: "Robert Haas"
Дата:
Сообщение: Re: array_length()