Hi I am proposing a simple function, that returns a position of element in array.
FUNCTION array_position(anyarray, anyelement) RETURNS int Implementation is simple (plpgsql code) CREATE OR REPLACE FUNCTION array_position(anyarray, anyelement) RETURNS int AS $$ DECLARE i int := 0; BEGIN FOREACH a IN ARRAY $1 LOOP IF a = $1 THEN RETURN i; END IF; i := i + 1; END LOOP; RETURN NULL; END; $$ LANGUAGE plpgsql IMMUTABLE STRICT; A possible benefits: 1. speed in plpgsql applications 2. reduced length of SQL functions Ideas, comments, notices? Regards Pavel