From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Determining return type of polymorphic function |
Date: | 2005-08-11 18:40:34 |
Message-ID: | 20050811184034.GD13966@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
[Please CC replies, thanks]
On Thu, Aug 11, 2005 at 02:17:30PM -0400, Tom Lane wrote:
> Martijn van Oosterhout <kleptog(at)svana(dot)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(at)svana(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-08-11 18:51:11 | Re: Determining return type of polymorphic function |
Previous Message | Tom Lane | 2005-08-11 18:17:30 | Re: Determining return type of polymorphic function |