Re: Domains versus polymorphic functions, redux

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Domains versus polymorphic functions, redux
Дата
Msg-id 12694.1306261852@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Domains versus polymorphic functions, redux  ("David E. Wheeler" <david@kineticode.com>)
Ответы Re: Domains versus polymorphic functions, redux
Список pgsql-hackers
"David E. Wheeler" <david@kineticode.com> writes:
> On May 24, 2011, at 10:11 AM, Tom Lane wrote:
>> On the other hand it feels like we'd be taking yet another step away
>> from allowing domains to be usefully used in function declarations.

> I agree. It sure seems to me like DOMAINs should act exactly like any
> other type. I know that has improved over time, and superficially at
> least, the above will make it seem like more like than it does with
> the error. But maybe it's time to re-think how domains are
> implemented? (Not for 9.1, mind.) I mean, why *don't* they act like
> first class types?

Well, if they actually were first-class types, they probably wouldn't
be born with an implicit cast to some other type to handle 99% of
operations on them ;-).  I think the hard part here is having that cake
and eating it too, ie, supporting domain-specific functions without
breaking the implicit use of the base type's functions.

I guess that the question that's immediately at hand is sort of a
variant of that, because using a polymorphic function declared to take
ANYARRAY on a domain-over-array really is using a portion of the base
type's functionality.  What we've learned from bug #5717 and the
subsequent issues is that using that base functionality without
immediately abandoning the notion that the domain has some life of its
own (ie, immediately casting to the base type) is harder than it looks.
        regards, tom lane


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Alignment padding bytes in arrays vs the planner
Следующее
От: "David E. Wheeler"
Дата:
Сообщение: Re: Domains versus polymorphic functions, redux