SELECT array_to_percentile('{}'::float[], 0.2); array_to_percentile --------------------- (1 row) SELECT array_to_percentile('{1,1,5,2,0,7}'::smallint[], 0.2); array_to_percentile --------------------- 1 (1 row) SELECT array_to_percentile('{1,1,5,2,0,7}'::integer[], 0.2); array_to_percentile --------------------- 1 (1 row) SELECT array_to_percentile('{1,1,5,2,0,7}'::bigint[], 0.2); array_to_percentile --------------------- 1 (1 row) SELECT array_to_percentile('{1,1,5,2,0,7}'::real[], 0.2); array_to_percentile --------------------- 1 (1 row) SELECT array_to_percentile('{1,1,5,2,0,7}'::float[], 0.2); array_to_percentile --------------------- 1 (1 row) SELECT array_to_percentile('{1,1,5,2,0,7}'::text[], 0.2); ERROR: Percentile subject must be SMALLINT, INTEGER, BIGINT, REAL, or DOUBLE PRECISION values SELECT array_to_percentile('{1,1,5,2,0,7}'::float[], 0); array_to_percentile --------------------- 0 (1 row) SELECT array_to_percentile('{1,1,5,2,0,7}'::float[], 1); array_to_percentile --------------------- 7 (1 row) SELECT array_to_percentile('{1,1,5,2,0,7}'::float[], 0.5); array_to_percentile --------------------- 1.5 (1 row) SELECT array_to_percentile('{1,2,5,3,0}'::float[], 0.5); array_to_percentile --------------------- 2 (1 row) SELECT array_to_percentile('{1,1,5,2,0,7}'::float[], -0.2); ERROR: Percent must be between 0 and 1 SELECT array_to_percentile('{1,1,5,2,0,7}'::float[], 1.2); ERROR: Percent must be between 0 and 1