overloaded functions and NULL

From: Kris Jurka <books(at)ejurka(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: overloaded functions and NULL
Date: 2004-10-12 21:07:07
Message-ID: Pine.BSO.4.56.0410121604490.7695@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


I thought all ambiguous function calls would generate an error:

ERROR: function g("unknown") is not unique
HINT: Could not choose a best candidate function. You may need to add
explicit type casts.

but this doesn't seem to be the case. The below code creates overloaded
functions that do not produce this error when called with a NULL argument.

jurka=# CREATE FUNCTION g(int) RETURNS int AS 'SELECT 1;' LANGUAGE sql;
CREATE FUNCTION
jurka=# CREATE FUNCTION g(float) RETURNS int AS 'SELECT 2;' LANGUAGE sql;
CREATE FUNCTION
jurka=# SELECT g(NULL);
g
---
2
(1 row)

Kris Jurka

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Mike G. 2004-10-12 22:35:17 Substring function incorrect when searching for '@.'
Previous Message Reuven M. Lerner 2004-10-12 19:55:16 Re: Fatal "make check" bug with 8.0 beta 3 under Mac OS 10.3