postgres=# \sf smallest CREATE OR REPLACE FUNCTION public.smallest(VARIADIC anyarray) RETURNS anyelement LANGUAGE sql IMMUTABLE AS $function$ SELECT min($1[i]) FROM generate_subscripts($1, 1) g(i); $function$
That's very helpful and good to know. It's too bad that doesn't work with LEAST/GREATEST, which would eliminate the need for extra functions.
These functions are differently implemented - and they are older than support of variadic functions.But implementation of passing a array should be easy.