pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Emil Rachovsky <zsevgymko@yahoo.com>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: problem with overloading the "coalesce" function
Date: Mon, 6 Mar 2006 02:18:12 -0800 (PST)
Message-ID: <20060306101812.89563.qmail@web54308.mail.yahoo.com> (raw)



 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 



view thread (5+ messages)  latest in thread

Message-ID: <20060306101812.89563.qmail@web54308.mail.yahoo.com>
Permalink:  ../20060306101812.89563.qmail@web54308.mail.yahoo.com/
Also on:    postgresql.org/message-id/20060306101812.89563.qmail@web54308.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: zsevgymko@yahoo.com, pgsql-general@postgresql.org
  Subject: Re: problem with overloading the "coalesce" function
  In-Reply-To: <20060306101812.89563.qmail@web54308.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox