title: Detecting and fixing corrupted indeces in Postgresql?
body: <p>Today I encountered a case where a record was missing in query result while existed in the table. I traced back the problem to probably a corrupted index. After I did <code>REINDEX</code> the problem was solved.</p>
  
  <p>The thing is that normally when I run reports I get more than a 10000 records. It is impossible for me to know if there are missing records. Today I was lucky to find the problem.</p>
  
  <p>Is there a way to get a notification when an index is corrupted?</p>
  
  <p>If not, how do I write a function that will <code>REINDEX</code> all indeces in my Schema?</p>