From: | Emil Rachovsky <zsevgymko(at)yahoo(dot)com> |
---|---|
To: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Cc: | "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | problem with overloading the "coalesce" function |
Date: | 2006-03-06 10:18:12 |
Message-ID: | 20060306101812.89563.qmail@web54308.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
Hi,
I am trying to overload the "coalesce" function to
accept an integer and a string. Here it is :
CREATE OR REPLACE FUNCTION "coalesce"(a int4, b
"varchar")
RETURNS "varchar" AS
$BODY$
begin
if (a is null ) then
return b;
else
return cast(a as varchar(15));
end if;
end
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "coalesce"(a int4, b "varchar") OWNER
TO postgres;
I have added it to pg_catalog, but still I cant't use
it, I get an error on the second parameter, apparently
the function gets lost at some point. Any additional
steps I need to complete?
Thanks in advance,
Emil
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2006-03-06 10:41:29 | Re: problem with overloading the "coalesce" function |
Previous Message | Csaba Nagy | 2006-03-06 09:52:27 | Re: query timeout |
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2006-03-06 10:41:29 | Re: problem with overloading the "coalesce" function |
Previous Message | Michael Louie Loria | 2006-03-06 01:23:29 | Visual and PostgreSQL |