title: Inserting unique values in PostgreSQL
body: <p>I am trying to insert the distinct values in my database:
  My query is like that:</p>
  
  <pre><code>    query2 = "INSERT INTO users (id, name, screenName, createdAt, defaultProfile, defaultProfileImage,\
      description) SELECT DISTINCT %s, %s, %s, %s, %s, %s, %s;"
  
      cur.execute(query2, (user_id, user_name, user_screenname, user_createdat, \
      default_profile, default_profile_image, description))
  </code></pre>
  
  <p>However, I still get the error: <strong>psycopg2.IntegrityError: duplicate key value violates unique constraint "users_key"</strong>.</p>
  
  <p>I guess that the query is inserting all data and then selects the distinct values?
  Another way I guess would be to store all data in a temporary database and then retrieve them for there. 
  But is there an easier way? </p>
  
  <p>Thank you! </p>