pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feed"any" to functions and function aliases
2+ messages / 2 participants
[nested] [flat]
* "any" to functions and function aliases
@ 2007-09-08 21:05 Peter Koczan <pjkoczan@gmail.com>
2007-09-08 21:33 ` Re: "any" to functions and function aliases Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: Peter Koczan @ 2007-09-08 21:05 UTC (permalink / raw)
To: 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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: "any" to functions and function aliases
2007-09-08 21:05 "any" to functions and function aliases Peter Koczan <pjkoczan@gmail.com>
@ 2007-09-08 21:33 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2007-09-08 21:33 UTC (permalink / raw)
To: Peter Koczan <pjkoczan@gmail.com>; +Cc: pgsql-admin
"Peter Koczan" <pjkoczan@gmail.com> writes:
> 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"
Use anyelement instead.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2007-09-08 21:33 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-09-08 21:05 "any" to functions and function aliases Peter Koczan <pjkoczan@gmail.com>
2007-09-08 21:33 ` Tom Lane <tgl@sss.pgh.pa.us>
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