Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 70FE29F9B1E for ; Sat, 8 Sep 2007 18:05:48 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 48780-06 for ; Sat, 8 Sep 2007 18:05:40 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.182]) by postgresql.org (Postfix) with ESMTP id 0E8FE9F9B15 for ; Sat, 8 Sep 2007 18:05:44 -0300 (ADT) Received: by wa-out-1112.google.com with SMTP id m38so1137922waf for ; Sat, 08 Sep 2007 14:05:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=3zAHJ9svuSgIvyXb2h6OZWBgArbS7mOtr78Mu8suUas=; b=SL2z3TYi4zJg81TS72IJlzg1DXeusLEjQ2L5XficXeQYqNxp724QrI/wRIn+QNVyP/uwctwFtdJtLndimU9NAAzjZpEQCMYcYG3U8DRncpHU1kbVXAZbj5klNJSRXi+sUqEkiQCQYbGaQtHHtWRh17oCOuoL0XF6ZZ/WwkixQbE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=tTgtWa45APuDIlQX5u4u3DvnpP5ttl/V5vJ4/hHafx1S9wtpp1f7H+dRZBUimp2JkWzjc2cZuB0jHc5xVzrN7CJKECTmqfVpwxzHsP+MFdgqEuo3ARJkirm7l9IMx+icB3xJPDf8BummUsY8sXQUS/ocPbyD2D+YAC8CwOE3Ga4= Received: by 10.114.106.1 with SMTP id e1mr2073627wac.1189285543390; Sat, 08 Sep 2007 14:05:43 -0700 (PDT) Received: by 10.114.197.19 with HTTP; Sat, 8 Sep 2007 14:05:43 -0700 (PDT) Message-ID: <4544e0330709081405gf456792i5ee4f0e7b40860ec@mail.gmail.com> Date: Sat, 8 Sep 2007 16:05:43 -0500 From: "Peter Koczan" To: "pgsql-admin@postgresql.org" Subject: "any" to functions and function aliases MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/52 X-Sequence-Number: 26813 Hi all, I have a question regarding functions. I'm in the process of porting old but necessary applications to postgres, and was wondering about a couple things regarding portability of functions. - Below I have an error message from pg_restore on an old database dump. Apparently this function worked properly in 7.4, but doesn't work on 8.2. The problem is that you can't specify the arbitrary data type "any" for a return value. Any ideas what's up? Note that there are isnull functions with specific return types, but this may not capture all types we need to. ------ pg_restore: [archiver (db)] Error from TOC entry 1156; 0 18175 FUNCTION isnull("any", "any") postgres pg_restore: [archiver (db)] could not execute query: ERROR: plpgsql functions cannot return type "any" Command was: CREATE FUNCTION "isnull"("any", "any") RETURNS "any" AS ' declare test alias for $1; alt alias for $2; begin if nullval... ------ - This function does the same thing as coalesce, is there any nice way to make isnull an alias for coalesce without having to create a lot of different functions for this purpose? I know we could rewrite our stuff to use coalesce instead of isnull, but if there's a way we could rewrite a less code on the client side, it would be better. Thanks, Peter