Re: Domains and type coercion

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Domains and type coercion
Дата
Msg-id 7200.1016750748@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Domains and type coercion  ("Rod Taylor" <rbt@zort.ca>)
Список pgsql-hackers
"Rod Taylor" <rbt@zort.ca> writes:
> It would be fairly straight forward  to simply copy the domain base
> type into the atttypid, then create an atttypdomain (normally 0,
> except in the case of a domain).  Everything would use the attypid,
> except for \d and pg_dump which could use the domain if it exists.

> Is this something I should do?

No, because it's quite irrelevant to the problem of type coercion,
which works with expressions; attributes are only one part of the
expression world.

Actually, considering Fernando's point that a CAST ought to apply the
constraints associated with a domain type, your attribute-based
implementation is wrong anyway.  Rather than merging the domain
constraints into the table definition (which will be a nightmare for
pg_dump to sort out, anyway) keep 'em separate.  The constraints could
be checked during casting from a base type to a domain type --- take a
look at the existing mechanism for enforcing typmod (length limits),
which after all is a simplistic kind of domain constraint.
        regards, tom lane


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

Предыдущее
От: "Rod Taylor"
Дата:
Сообщение: Re: Domains and type coercion
Следующее
От: reina@nsi.edu (Tony Reina)
Дата:
Сообщение: Problem compiling PostgreSQL 7.2 on IRIX 6.5.15f