Re: Domains as Subtypes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Domains as Subtypes
Дата
Msg-id 12565.1143242833@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Domains as Subtypes  (elein <elein@varlena.com>)
Ответы Re: Domains as Subtypes  (elein <elein@varlena.com>)
Список pgsql-hackers
elein <elein@varlena.com> writes:
> Operators have the single distinction from functions in that when one argument
> has an unknown type, then an exact match is tried with the unknown arg
> type set to the known type.  This code has always been in there.

Yeah, but it's just a fast special case of the generic UNKNOWN handling
in func_select_candidate.  The domain special case in binary_oper_exact
is a wart --- ideally it should be excised not enlarged ;-).  It's
mainly there because we didn't want to complicate func_select_candidate
to deal with domains.  If you're going to do the latter anyway, it may
be possible to remove the domain special case in binary_oper_exact.

In any case, the patch is very poorly thought through: it will not
behave reasonably if there are multiple levels of domains with different
candidate operators attached to each domain.  (I can tell you have not
tested this: getBaseType drills all the way down, so mk_oper_arg_list
isn't doing what you think.)  You need some kind of policy as to which
candidate is more preferable if some are "closer" types on one input and
some are "closer" on another, and binary_oper_exact is not the place for
that kind of decision.  It's only supposed to be a fast short-circuit
for the cases of exact matches and exact-after-substituting-other-type-
for-UNKNOWN matches.  If you make it do more you'll be upsetting some
careful compromises in the type resolution rules.
        regards, tom lane


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Role incompatibilities
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: Role incompatibilities