> > CREATE OR REPLACE FUNCTION idx(anyarray, anyelement) > RETURNS int AS $$ > SELECT i > FROM (SELECT generate_subscripts($1) as i, unnest($1) as v) s > WHERE v = $2 > LIMIT 1; > $$ LANGUAGE sql; > there is bug correct is create or replace function idx(anyarray, anyelement) returns int as $$ select i from (select generate_subscripts($1,1) i, unnest($1) v) s where v = $2 limit 1 $$ language sql; and it is 5% faster than older version on integer array on my eeepc Regards Pavel -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general