Re: Determining return type of polymorphic function

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Determining return type of polymorphic function
Дата
Msg-id 20050811184034.GD13966@svana.org
обсуждение исходный текст
Ответ на Re: Determining return type of polymorphic function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
[Please CC replies, thanks]

On Thu, Aug 11, 2005 at 02:17:30PM -0400, Tom Lane wrote:
> Martijn van Oosterhout <kleptog@svana.org> writes:
> > What I'm trying to do now is use fcinfo->flinfo->fn_oid to lookup
> > pg_proc and get the return type from there, but something tells me
> > there must be an easier way.
>
> No, I think you're stuck.  The internal calls for type I/O routines
> don't set up fn_expr (since there is no expression tree).
>
> One possibility, depending on your time horizon for this, is to change
> the getTypeIOParam rules so that ordinary types get their own OID as
> second argument.

Hmm, I was thinking about that. While reading the documentation I was
thinking "surely they'd pass their own oid, giving zero would be silly"
so I was kind of surprised when I did get zero.

I was thinking of actually also storing the oid in the typelem field
but the docs imply this does something fancy with subscripting. I
havn't traced the code paths for that yet. At the very least I think it
would confuse anything looking for arrays. I also thought about typmod
(the third argument) but that seems to almost always be -1.

Would a patch to change the rules be accepted, or would it be
considered a unnecessary backward incompatable change?

Thanks in advance,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Determining return type of polymorphic function
Следующее
От: Mischa Sandberg
Дата:
Сообщение: Logging explain-analyze output in pg log?