Re: [PATCH] Clarify issues with SPI and C language function limitations

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCH] Clarify issues with SPI and C language function limitations
Date: 2005-08-14 12:24:19
Message-ID: 20050814122415.GB2875@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On Sat, Aug 13, 2005 at 06:27:29PM -0400, Tom Lane wrote:
> Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> > The second clarifies when the get_fn_expr_rettype() and
> > get_fn_expr_argtype() functions can actually provide the information
> > requested.
>
> Except it doesn't actually tell you anything very definite ...

Well, that's because it isn't. If you call a type input function
explicitly as part of a query then the info will be available. If
someone uses your function by calling DirectFunctionCall or
OidFunctionCall then the information isn't available.

You can't be definite since it is caller who decides, the person
writing the function can't know.

Given that OidFunctionCall is not mentioned in the documentation
currently, I figured that using it here to describe why these calls
won't work would be a waste of time given people won't know what it
means anyway. Hence the vagueness.

I would favour adding the return type and arg types to FmgrInfo,
because that's nearly always available (except when using
DirectFunctionCall). Still no guarentee, but better. It means I
wouldn't need to create a dummy flinfo->fn_expr when calling a
polymorphic function from C.

I just feel this whole mess needs to be documented *somewhere*, I'm
just not sure where...

Have a nice day,
--
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.

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2005-08-14 16:26:02 Re: [HACKERS] For review: Server instrumentation patch
Previous Message Martijn van Oosterhout 2005-08-14 11:52:24 Re: [PATCH] Proposed: Have SPI_connect fail if there is no current snapshot