title: Django DatabaseError - No such savepoint
body: <p>I have a function the a Celery task calls in my Django app that processes each row in a CSV file and tries to insert information from each row into the PostgreSQL database using a model, like so:</p>
  
  <pre><code>reader = csv.DictReader(csvfile, dialect=csv.get_dialect('excel'))
  for row_number, row in enumerate(reader):
      try:
          ...
          customer, created = Customer.objects.get_or_create(
              first_name = row['First Name'],
              last_name = row['Last Name'],
              email = row['Email'],
              account_owner = account_owner
          )
          ...
      except Exception, e:
          message = "%s: %s\n" % (type(e).__name__, e)
          sys.stderr.write("%s\n" % message)
  </code></pre>
  
  <p>I'm getting the following error at <code>Customer.objects.get_or_create</code> on the first iteration of the loop:
  <code>DatabaseError: no such savepoint</code></p>
  
  <p>And then I'm getting <code>DatabaseError: current transaction is aborted, commands ignored until end of transaction block</code> for each iteration thereafter.</p>
  
  <p>I have successfully inserted (manually with SQL) a record into this table with the same information the script would provide. I have also tried working with savepoints, with no luck:</p>
  
  <pre><code>sid = transaction.savepoint()
  customer, created = Customer.objects.get_or_create(
      first_name = row['First Name'],
      last_name = row['Last Name'],
      email = row['Email'],
      account_owner = account_owner
  )
  transaction.savepoint_commit(sid)
  </code></pre>
  
  <p>This is happening on my dev machine with PostgreSQL 9.1 installed from Homebrew. Obviously the main goal is to fix this issue, but any helpful pointers for debugging the Celery task or locating my Postgres log files would be helpful also.</p>