Re: function overloading

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: greimel(at)ing(dot)iac(dot)es
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: function overloading
Date: 2006-01-09 20:28:36
Message-ID: 7740.1136838516@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Robert Greimel <greimel(at)ing(dot)iac(dot)es> writes:
> I have a question regarding function overloading:

> assume that you have a function that takes several numeric arguments -
> lets for example say 4 arguments: f(a,b,c,d)

> Now further assume that internally in the function the first thing you
> do is to convert the arguments to double precision, do your calculations
> and return the result always in double precision.

> In order to allow for all combinations of numeric
> (int2,int4,int8,float4,float8) inputs one would now have to define and
> write 5^4 = 625 functions !!!!!!!!!!!!!!!

> Apart from forcing the function user to use casts, is there any other
> way to avoid this madness of writing 625 functions ?

I don't see why you need more than one function, taking all
double-precision arguments ...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthew Peter 2006-01-09 21:01:33 Re: plpgsql question
Previous Message Tom Lane 2006-01-09 20:26:35 Re: help with rules for system table