Skip site navigation (1) Skip section navigation (2)

function overloading

From: Robert Greimel <greimel(at)ing(dot)iac(dot)es>
To: pgsql-general(at)postgresql(dot)org
Subject: function overloading
Date: 2006-01-09 15:30:08
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general

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 ?




pgsql-general by date

Next:From: Jaime CasanovaDate: 2006-01-09 15:51:48
Subject: Re: [ANNOUNCE] CRITICAL RELEASE: Minor Releases to Fix DoS
Previous:From: MARCELO_LIMA/BlnetDate: 2006-01-09 15:03:10
Subject: read txt and insert table

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group