Basic Median aggregate function suitable for PL/Java with PostgreSQL