Re: Unsigned int functions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Unsigned int functions
Дата
Msg-id 23707.985895500@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Unsigned int functions  (Adriaan Joubert <a.joubert@albourne.com>)
Ответы Re: Unsigned int functions  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
Adriaan Joubert <a.joubert@albourne.com> writes:
> Question is: should I add these functions? Are we looking at too much
> bloat, i.e. should I replace the (uint2,uint4) combinations with
> (int4,uint2) and (int4,uint4)? Lots of combinations are possible, but I
> do not have a good feel for the trade-offs. 

My guess is that we ought to avoid bloating the system with
cross-datatype functions.  I know there are some already for int2*int4
and so forth, but I'd like to see those go away in favor of a smarter
type promotion scheme --- ie, the parser should be able to figure out
that it ought to do int2_var * uint4_var asuint4_mul(uint4(int2_var), uint4_var)
A cross-datatype function ought to exist only if it can usefully do
something different from an implicit promotion.

Aside from bloating the system, providing a plethora of functions also
tends to confuse the ambiguous-function-call resolution mechanism.
See discussion of a few days ago wherein the parser could resolve an
ambiguous situation involving varchar, but could not resolve the same
situation with text, because there are too many possibilities for
coercion of text to something else.
        regards, tom lane


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

Предыдущее
От: Adriaan Joubert
Дата:
Сообщение: Unsigned int functions
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Unsigned int functions