title: Terminate hung query (idle in transaction)
body: <p>I'm using Heroku with the Crane Postgres option and I was running a query on the database from my local machine when my local machine crashed. If I run </p>
  
  <pre><code>select * from pg_stat_activity
  </code></pre>
  
  <p>one of the entries has</p>
  
  <pre><code>&lt;IDLE&gt; in transaction
  </code></pre>
  
  <p>in the current_query_text column.</p>
  
  <p>As a result, I can't drop the table that was being written to by the query that was terminated. I have tried using pg_cancel_backend(N) and it returns True but nothing seems to happen.</p>
  
  <p>How can I terminate this process so that I can drop the table?</p>