title: How to turn on PostgreSQL VERBOSITY in django db connection?
body: <p>This is a follow up question to this: </p>
  
  <p><a href="https://stackoverflow.com/questions/41959752/postgres-more-verbose-error-message-i-am-missing-the-table-name">Postgres: More verbose error message: I am missing the table name</a></p>
  
  <p>PostgreSQL 9.6 improved error messages with version 9.6.</p>
  
  <p>With <code>psql</code> you can enable it <code>\set VERBOSITY verbose</code>.</p>
  
  <p>How to enable this for every connection inside django ORM?</p>
  
  <p>Background: I want better error messages.</p>
  
  <p>Example: I am missing the table name in messages like this</p>
  
  <pre><code>IntegrityError: null value in column "date" violates not-null constraint
  DETAIL:  Failing row contains (10005, null, f, TEST, MAIL).
  </code></pre>
  
  <p>I think the relevant part of the <a href="https://www.postgresql.org/docs/9.6/static/release-9-6.html#AEN131275" rel="nofollow noreferrer">9.6 release notes</a> is this:</p>
  
  <blockquote>
    <p>Add support in libpq for regenerating an error message with a different verbosity level (Alex Shulgin)</p>
    
    <p>This is done with the new function PQresultVerboseErrorMessage(). This supports psql's new \errverbose feature, and may be useful for other clients as well.</p>
  </blockquote>
  
  <p>I use psycopg2 as database adapter.</p>