title: Postgres: cursor.execute("COMMIT") vs. connection.commit()
body: <p>I am running a postgres 9.2 server and have a python client using psycopg 2.5.</p>
  
  <p>I ran some tests because I experience a lot of <code>WARNING: there is no transaction in progress</code> entries in my log files.</p>
  
  <p>I have some code that can be simplified to the following:</p>
  
  <pre><code>import psycopg2
  
  connection = psycopg2.connect(...)
  with connection.cursor() as cursor:
      # Multiple insert statements
      cursor.execute("INSERT INTO ...")
  
      cursor.execute("COMMIT")
  </code></pre>
  
  <p>What I found that if I do the following, as soon as the first <code>COMMIT</code> is run (I reuse the same connection, so the above code is run multiple times) every statement afterwards is instantly committed. However, if I instead run <code>connection.commit()</code> it works as expected (commit statements made so far, future statements will not be committed automatically).</p>
  
  <p>Is this a bug or is there some fine distinction I have missed somewhere in how this works? Is this a postgres issue or something to do with the innards of psycopg2?</p>
  
  <p>Thanks in advance!</p>