title: nth percentile calculations in postgresql
body: <p>I've been surprisingly unable to find an nth percentile function for postgresql.</p>
  
  <p>I am using this via mondrian olap tool so i just need an aggregate function which returns a 95th percentile.</p>
  
  <p>I did find this link:</p>
  
  <p><a href="http://www.postgresql.org/message-id/162867790907102334r71db0227jfa0e4bd96f48b8e4@mail.gmail.com" rel="noreferrer">http://www.postgresql.org/message-id/162867790907102334r71db0227jfa0e4bd96f48b8e4@mail.gmail.com</a></p>
  
  <p>But for some reason the code in that percentile function is returning nulls in some cases with certain queries. I've checked the data and there's nothing odd in the data that would seem to cause that!</p>