Re: Domain breakage

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Domain breakage
Дата
Msg-id 21892.1053909321@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Domain breakage  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Awhile back I said:
> Here's a fun one: in 7.3 or CVS tip, try
> regression=# create domain tint as int;
> CREATE DOMAIN
> regression=# select  1::tint > (-1);
>  ?column?
> ----------
>  t
> (1 row)

> regression=# select  1::tint > (-1)::tint;
>  ?column?
> ----------
>  f
> (1 row)

> How's that again?  Well, when you dig into it you find that the second
> case is invoking the OID greater-than operator (oidgt), which does
> unsigned comparison.

> I suspect that the most workable fix for this is to reduce all the input
> typeids to base types before we start the operator or function type
> resolution routines.  However, this would completely destroy any hope of
> making domain-specific operators.

I have repaired this problem by doing the above.  It turns out that this
does not completely foreclose building domain-specific operators: the
check for exact-match operators is done beforehand, so you can use a
domain-specific operator as long as it's an exact match to the input
datatypes.  But as soon as there's not an exact match, operators on the
base type will be preferred.  This seems a workable compromise to me.
        regards, tom lane


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: array functions - request for opinions (was Re: [PATCHES] array
Следующее
От: Tom Lane
Дата:
Сообщение: Re: vacuum analyze corrupts database