title: psycopg2 TypeError: not all arguments converted during string formatting
body: <p>I'm trying execute a simple query, but getting this error no matter how I pass the parameters.</p>
  
  <p>Here is the query (I'm using Trac db object to connect to a DB):</p>
  
  <pre><code>cursor.execute("""SELECT name FROM "%s".customer WHERE firm_id='%s'""" % (schema, each['id']))
  </code></pre>
  
  <p>schema and each['id'] both are simple strings</p>
  
  <pre><code>print("""SELECT name FROM "%s".customer WHERE firm_id='%s'""" % (schema, each['id']))
  </code></pre>
  
  <p>Result:
  <code>SELECT name FROM "Planing".customer WHERE firm_id='135'</code></p>
  
  <p>There is on error is a remove quote after <code>firm_id=</code>, but that way parameter is treated a an integer and <code>::text</code> leads to the very same error.</p>