X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id ABA659DC84C for ; Mon, 6 Mar 2006 06:18:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82772-05 for ; Mon, 6 Mar 2006 06:18:15 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web54308.mail.yahoo.com (web54308.mail.yahoo.com [206.190.49.118]) by postgresql.org (Postfix) with SMTP id 460D89DC81D for ; Mon, 6 Mar 2006 06:18:10 -0400 (AST) Received: (qmail 89565 invoked by uid 60001); 6 Mar 2006 10:18:12 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding; b=wNTd6nLXcEtZYy+NRU+5wXrSz7KQ4C+Kvm3KSlzxQ1D0SMeEXrgA0Z6azSQh646sejpWUmnc/f5IXlenrvTOOOBPKWuobSS3oiki1Bj4ax5+8U4XjDC7mJ0rFZ/kTHKPuM0PIF8V6N2+SxIE6tYTsoAn/XyEgb68/Kugzpwyon0= ; Message-ID: <20060306101812.89563.qmail@web54308.mail.yahoo.com> Received: from [213.91.244.26] by web54308.mail.yahoo.com via HTTP; Mon, 06 Mar 2006 02:18:12 PST Date: Mon, 6 Mar 2006 02:18:12 -0800 (PST) From: Emil Rachovsky Subject: problem with overloading the "coalesce" function To: "pgsql-general@postgresql.org" Cc: "pgsql-sql@postgresql.org" MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.884 required=5 tests=[AWL=-0.474, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_WHOIS=0.879] X-Spam-Score: 0.884 X-Spam-Level: X-Archive-Number: 200603/197 X-Sequence-Number: 92062 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