Re: get_cast_func syscache utility function

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: get_cast_func syscache utility function
Дата
Msg-id 2425.1415200245@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: get_cast_func syscache utility function  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: get_cast_func syscache utility function  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> On 11/04/2014 01:45 PM, Tom Lane wrote:
>> In short, I'd rather see this addressed through functions with slightly
>> higher-level APIs that are capable of covering more cases.  In most cases
>> it'd be best if callers were using find_coercion_pathway() rather than
>> taking shortcuts.

> Well, then, do we really need a wrapper at all? Should we just be doing 
> something like this?

>                  if (typoid >= FirstNormalObjectId)
>                  {
>                      Oid castfunc;
>                      CoercionPathType ctype;

>                      ctype = find_coercion_pathway(JSONOID, typoid,
>                                                    COERCION_EXPLICIT, &castfunc);

>                      if (ctype == COERCION_PATH_FUNC && OidIsValid(castfunc))
>                      {
>                          *tcategory = JSONTYPE_CAST;
>                          *outfuncoid = castfunc;
>                      }
>                  }

Well, of course, the question that immediately raises is why isn't this
code handling the other possible CoercionPathTypes ;-).  But at least
it's pretty obvious from the code that you are ignoring such cases,
so yes I think this is better than what's there now.
        regards, tom lane



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

Предыдущее
От: Petr Jelinek
Дата:
Сообщение: Re: Sequence Access Method WIP
Следующее
От: Magnus Hagander
Дата:
Сообщение: Order of views in stats docs