title: Is there a postgres CLOSEST operator?
body: <p>I'm looking for something that, given a table like:</p>
  
  <pre><code>| id | number |
  |  1 |     .7 |
  |  2 |   1.25 |
  |  3 |   1.01 |
  |  4 |    3.0 |
  </code></pre>
  
  <p>the query <code>SELECT * FROM my_table WHERE</code>number<code>CLOSEST(1)</code> would return row 3. I only care about numbers. Right now I've got a procedure that just loops over every row and does a comparison, but I figure the information should be available from a b-tree index, so this might be possible as a builtin, but I can't find any documentation suggesting that it does.</p>