Thomas Hallgren <[EMAIL PROTECTED]> writes: > I've been trying to use "any" with no luck. How do I declare a function > that takes an "any" as a parameter?
ANY is a reserved word, so to use it as a type name you need quotes: regression=# create function foo("any") returns int as '' language sql; ERROR: SQL functions cannot have arguments of type "any" (This may be another reason why we went for "anyelement" ...) > I realize that it would be trickier to return an "any" since the > expected return type must somehow be derived from the context where the > function was called. You really can't use "any" as a function result type; it's not sensible because there's no way to infer an actual type. There are functions for which an "any" argument type is sensible, eg count(*), but I don't see a use for this pseudotype as a result type. > Wouldn't it be a good idea to let the SQL parser recognize the > anyelement[] construct as a synonym for anyarray? [ shrug... ] Can't get excited about it. It'd complicate and confuse the documentation, as well as the code, for zero functional improvement. I also have a gut feeling that this is really wrong anyhow. anyarray isn't an array, it's a placeholder. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match