Can't use "any" with SQL functions

Started by Jim Nasbyalmost 17 years ago4 messagesgeneral
Jump to latest
#1Jim Nasby
Jim.Nasby@BlueTreble.com

Is there a reason we disallow using "any" with SQL functions?

decibel@phonebook.local=# create function textcoalesce("any") returns
void language sql as $$SELECT coalesce( $1::text, '<NULL>' )$$;
ERROR: SQL functions cannot have arguments of type "any"
STATEMENT: create function textcoalesce("any") returns void language
sql as $$SELECT coalesce( $1::text, '<NULL>' )$$;
ERROR: SQL functions cannot have arguments of type "any"
decibel@phonebook.local=# SELECT version();

version
------------------------------------------------------------------------
-----------------------------------------------------------------------
PostgreSQL 8.3.7 on powerpc-apple-darwin8.11.0, compiled by GCC
powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc.
build 5370)
(1 row)

decibel@phonebook.local=#
--
Decibel!, aka Jim C. Nasby, Database Architect decibel@decibel.org
Give your computer some brain candy! www.distributed.net Team #1828

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jim Nasby (#1)
Re: Can't use "any" with SQL functions

Decibel! <decibel@decibel.org> writes:

Is there a reason we disallow using "any" with SQL functions?

Yes. Try "anyelement" instead.

regards, tom lane

#3Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Tom Lane (#2)
Re: Can't use "any" with SQL functions

BTW is there a reason the error messages say "plpgsql functions cannot
..." instead of "PL/pgSQL functions cannot ..."?

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alvaro Herrera (#3)
Re: Can't use "any" with SQL functions

Alvaro Herrera <alvherre@commandprompt.com> writes:

BTW is there a reason the error messages say "plpgsql functions cannot
..." instead of "PL/pgSQL functions cannot ..."?

Somewhere along the line there was the idea that the messages ought to
match the "real" name of the PL language, which is plpgsql. The other
name is marketing.

regards, tom lane