Re: test datatype for ANY

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: NosyMan <nosyman(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: test datatype for ANY
Date: 2005-02-11 19:32:31
Message-ID: 12939.1108150351@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Michael Fuhr <mike(at)fuhr(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ignacio Colmenero 2005-02-11 19:49:13 Re: ERROR: control reached end of function without RETURN
Previous Message Tom Lane 2005-02-11 19:28:13 Re: ERROR: control reached end of function without RETURN