any, anyelement, and anyarray - Mailing list pgsql-hackers

From Thomas Hallgren
Subject any, anyelement, and anyarray
Date
Msg-id 44645A2D.2040401@tada.se
Whole thread Raw
Responses Re: any, anyelement, and anyarray
List pgsql-hackers
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





pgsql-hackers by date:

Previous
From: Mario Weilguni
Date:
Subject: Re: BEGIN inside transaction should be an error
Next
From: Dhanaraj M
Date:
Subject: Clarification required