Re: function with different return type depending on parameter?

From: Pavel Stehule <pavel(dot)stehule(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:25:42
Message-ID: CAFj8pRB9NvoYROx4zbUrAqqN2ypR2DuiAOgxC=FumJbsu-hVUw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

no it is not possible

Regards

Pavel

p.s. result - type must be known before execution (when execution plan is
created)

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 Glyn Astill 2014-02-12 11:43:47 Re: pgsql and asciidoc output
Previous Message Rémi Cura 2014-02-12 09:23:41 Re: function with different return type depending on parameter?