Re: function with different return type depending on parameter?

From: Rémi Cura <remi(dot)cura(at)gmail(dot)com>
To: James Harper <james(dot)harper(at)bendigoit(dot)com(dot)au>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: function with different return type depending on parameter?
Date: 2014-02-12 09:23:41
Message-ID: CAJvUf_tXRjjJhyKW65nk504WbKXZau1zoQB3L4m8R2XwBnjnEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hey
http://www.postgresql.org/docs/9.3/static/plpgsql-declarations.html
at anyelement.

Cheers
Rémi-C

2014-02-12 10:20 GMT+01:00 James Harper <james(dot)harper(at)bendigoit(dot)com(dot)au>:

> is it possible to have a function that can return a different type
> depending on the parameters? Eg (approximately)
>
> if param = "one" then return 1
> if param = "two" then return "2"
> if param = "three" then return 3.0
> etc
>
> I can't see any variant type
>
> thanks
>
> James
>
>
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2014-02-12 09:25:42 Re: function with different return type depending on parameter?
Previous Message James Harper 2014-02-12 09:20:26 function with different return type depending on parameter?