David Fetter and I were just looking at something on IRC... decibel=# select most_common_vals[1] from pg_stats where tablename='pg_depend' and attname='classid'; ERROR: cannot subscript type anyarray because it is not an array decibel=# select most_common_freqs[1] from pg_stats where tablename='pg_depend' and attname='classid'; most_common_freqs ------------------- 0.566 (1 row)
ISTM you'd want to be able to reference an individual element of an ANYARRAY... but this gets even more odd... decibel=# CREATE OR REPLACE FUNCTION array_to_set(anyarray) RETURNS SETOF anyelement LANGUAGE SQL AS $$ SELECT $1[i] from generate_series(array_lower($1, 1), array_upper($1, 1)) i $$; CREATE FUNCTION decibel=# select array_to_set(most_common_vals) from pg_stats where tablename='pg_depend' and attname='classid'; ERROR: argument declared "anyarray" is not an array but type anyarray I expected that not to work, but the error is somewhat interesting... I didn't expect the following to work: decibel=# select array_to_set(most_common_freqs) from pg_stats where tablename='pg_depend' and attname='classid'; array_to_set -------------- 0.566 0.235667 0.126333 0.0343333 0.02 0.0163333 0.000666667 0.000666667 (8 rows) decibel=# ISTM you should be able to call an anyarray function with an anyarray, and that you should be able to reference individual elements of an anyarray... -- Decibel!, aka Jim Nasby [EMAIL PROTECTED] EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)
pgpm6S6a0F82i.pgp
Description: PGP signature