Re: [GENERAL] test datatype for ANY

2005-02-11 Thread Tom Lane
Michael Fuhr <[EMAIL PROTECTED]> writes: > On Fri, Feb 11, 2005 at 03:37:01PM -0500, Tom Lane wrote: >> [ thinks about that for awhile... ] Oh, I see. The reason this appears >> to work is that plpgsql compiles a separate version of the function for >> each actual parameter datatype that is used

Re: [GENERAL] test datatype for ANY

2005-02-11 Thread Michael Fuhr
On Fri, Feb 11, 2005 at 03:37:01PM -0500, Tom Lane wrote: > [ thinks about that for awhile... ] Oh, I see. The reason this appears > to work is that plpgsql compiles a separate version of the function for > each actual parameter datatype that is used in a given session. So in > your example, yo

Re: [GENERAL] test datatype for ANY

2005-02-11 Thread Tom Lane
Michael Fuhr <[EMAIL PROTECTED]> writes: > On Fri, Feb 11, 2005 at 02:32:31PM -0500, Tom Lane wrote: >> There are some limited cases you could handle in plpgsql using the >> polymorphic-functions stuff (ie, ANYELEMENT not ANY) but it still has >> no concept of a run-time type test. > Eh? What am

Re: [GENERAL] test datatype for ANY

2005-02-11 Thread Michael Fuhr
On Fri, Feb 11, 2005 at 02:32:31PM -0500, Tom Lane wrote: > There are some limited cases you could handle in plpgsql using the > polymorphic-functions stuff (ie, ANYELEMENT not ANY) but it still has > no concept of a run-time type test. Eh? What am I misunderstanding then? The following done in

Re: [GENERAL] test datatype for ANY

2005-02-11 Thread Tom Lane
Michael Fuhr <[EMAIL PROTECTED]> writes: > On Fri, Feb 11, 2005 at 08:40:53PM +, NosyMan wrote: >> I want something like this: >> >> CREATE OR REPLACE FUNCTION myfunction(_param ANY) RETURNS INTEGER AS $$ > PostgreSQL has an undocumented IS OF construct: ... which won't help since IS OF is a

Re: [GENERAL] test datatype for ANY

2005-02-11 Thread Michael Fuhr
On Fri, Feb 11, 2005 at 08:40:53PM +, NosyMan wrote: > > How can I test the type of a parameter passed to a function via ANY data > type? > I want something like this: > > CREATE OR REPLACE FUNCTION myfunction(_param ANY) RETURNS INTEGER AS $$ > BEGIN > IF "_param IS OF