Thomas Hallgren <[EMAIL PROTECTED]> writes: > - 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.
"any" isn't the same as "anyelement", because it doesn't have the property of constraining different argument positions to be the same type. For instance, compare(any,any) and compare(anyelement,anyelement) would accept different sets of input types. There's some historical background to this, having to do with the fact that "any" existed first. Possibly we wouldn't have bothered with "any" if all had been invented at the same time. But I feel no pressure to remove "any". > - Why isn't the 'anyarray' declared as an array using the elemenent type > 'anyelement' in pg_type? Because it's a pseudotype, not a type. > - Why can't I write 'anyelement[]'. Shouldn't that be the same thing as > 'anyarray'? No, you're confusing these with actual datatypes. They are pseudotypes, which means they're only allowed as function argument/result type placeholders. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings