Re: test datatype for ANY - Mailing list pgsql-general

From Tom Lane
Subject Re: test datatype for ANY
Date
Msg-id 12939.1108150351@sss.pgh.pa.us
Whole thread Raw
In response to Re: test datatype for ANY  (Michael Fuhr <mike@fuhr.org>)
Responses Re: test datatype for ANY  (Michael Fuhr <mike@fuhr.org>)
List pgsql-general
Michael Fuhr <mike@fuhr.org> writes:
> On Fri, Feb 11, 2005 at 08:40:53PM +0000, 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 parse-time test, and he needs a
run-time one.  However, he'll never get that far anyway since plpgsql
doesn't allow ANY parameters.  AFAIK the *only* way you could write such
a function is in C (using get_fn_expr_argtype()).

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.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: ERROR: control reached end of function without RETURN
Next
From: "Ignacio Colmenero"
Date:
Subject: Re: ERROR: control reached end of function without RETURN