CREATE OR REPLACE FUNCTION public.explode_array(in_array anyarray) RETURNS SETOF anyelement LANGUAGE sql IMMUTABLE AS $function$ SELECT ($1)[s] FROM generate_series(1,array_upper($1, 1)) AS s; $function$