Function overloading

From: Rynell Wesson <rwesson(at)cs(dot)utexas(dot)edu>
To: pgsql-admin(at)postgresql(dot)org
Subject: Function overloading
Date: 2000-12-10 03:42:09
Message-ID: Pine.LNX.4.21.0012092116100.30190-100000@isle-of-jura.cs.utexas.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I have tried to overload a function with the following signatures.

CREATE FUNCTION foo(int4, int4)
RETURNS NUMERIC AS '

CREATE FUNCTION foo(text, text)
RETURNS NUMERIC AS '

Can someone please tell me how to make these overloaded functions work
at the same time? I keep getting the following error.

psql:fdm:11: ERROR: Function 'foo(unknown, unknown)' does not exist
Unable to identify a function that satisfies the given argument types
You may need to add explicit typecasts

The foo(text, text) works just fine alone when I do not compile/store the
foo(int4, int4) procedure in the database together with it. The
foo(int4, int4) procedure works regardless of whether I compile/store the
foo(text, text) procedure together with it in the database. The error
message seems to be complaining about the foo(text, text) procedure. I
have tried the following typecasts and format conversions to see if it
would accept it, but still with no success. Maybe I am casting the
types incorrectly. Can someone help me out?

select foo((text) 'testing', (text) 'testing');
select foo((varchar) 'testing', (varchar) 'testing');
select foo(text('testing'), text('testing'));
select foo(varchar('testing'), varchar('testing'));
... and others that did not work....

Here is the output of \df foo

List of functions
Result | Function | Arguments
---------+----------+------------
numeric | foo | int4 int4
numeric | foo | text text
(2 rows)

Additional info:

Operating System: Linux 2.2.16 #1 SMP i686
Postgres version: 7.0.2

Thanks.

Rynell Wesson

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Annett Katzschner 2000-12-10 16:08:53 documentation about PostgreSQL on NT
Previous Message Bruce Momjian 2000-12-09 23:12:22 Re: ERROR: cannot find attribute 1 of relation pg_temp