Skip site navigation (1) Skip section navigation (2)

"any" to functions and function aliases

From: "Peter Koczan" <pjkoczan(at)gmail(dot)com>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: "any" to functions and function aliases
Date: 2007-09-08 21:05:43
Message-ID: 4544e0330709081405gf456792i5ee4f0e7b40860ec@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-admin
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

Responses

pgsql-admin by date

Next:From: Tom LaneDate: 2007-09-08 21:33:45
Subject: Re: "any" to functions and function aliases
Previous:From: Scott MarloweDate: 2007-09-08 01:57:34
Subject: Re: Can't login to 8.2.4 if not superuser...

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group