From: | Kyle <kaf(at)nwlink(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | function overloading / ambigous functions |
Date: | 2001-03-05 22:01:48 |
Message-ID: | 15012.3276.14903.362526@ip146.usw5.rb1.bel.nwlink.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I'm having some difficulty with overloading functions. I've created a
function that normally takes int2's. This works fine, but then I
decided to overload it with a version that takes float8 as input. The
problem arises because the float8 version seems to be called every
time, unless an argument is explicitly cast to int2. Given:
CREATE FUNCTION my_search(int2, int2, int2, int2)
RETURNS int4 AS '/home/kaf/lib/my_search.so',
'my_search' LANGUAGE 'c';
CREATE FUNCTION my_search(float8, float8, float8, float8)
RETURNS int4 AS '/home/kaf/lib/my_search.so',
'my_search_float8' LANGUAGE 'c';
select my_search(7879,3727,3061,2502);
this uses the float8 implementation. I'd expect the int2
implementation to be used since none of the arguments contain floats.
Is this the expected behavior? Of course, if I explicitly cast any
argument to an int2, the int2 function is called.
Thanks,
-Kyle
From | Date | Subject | |
---|---|---|---|
Next Message | Chris | 2001-03-05 22:20:25 | Re: RPMs for PHP accessing PostgreSQL via ODBC over RedHat |
Previous Message | Soma Interesting | 2001-03-05 22:01:19 | upper() vs. lower() |