I have some questions regarding any, anyelement, and anyarray.
- Why does PostgreSQL declare three different generic types? Isn't one
enough? ISTM it would be far simpler to use constructs like 'any' and
'any[]' but neither of them are permitted.
- Why isn't the 'anyarray' declared as an array using the elemenent type
'anyelement' in pg_type?
- Why can't I write 'anyelement[]'. Shouldn't that be the same thing as
'anyarray'?
- The 'any' is listed as a type but I get a syntax error whenever I try
to use it. If I could use it, what would be the difference between 'any'
and 'anyelement'? The only thing I can think of is if 'anyelement' was
restricted to non-arrays, but apparently it isn't. I've tried and
there's nothing stopping me from passing an 'int[]' to a function that
takes an 'anyelement'.
Regards,
Thomas Hallgren