If you use intarray type it is convenient to call buil-in intarray functions for your purpose.
http://www.postgresql.org/docs/8.3/static/intarray.html SELECT t.a[1] AS "min", t.a[array_upper(t.a, 1)] AS "max" FROM (SELECT sort(string_to_array('2,3,4,15,6,7',',')::int[]) AS a)t; -- Best regards, Yuri. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql