title: Automatic password hashing in PostgreSQL
body: <p>I have been using PostgreSQL for the past few weeks and I have been loving it!</p>
  
  <p>I use crypt() and gen_salt() to generate the password hashes, by adding it to the insert query like so:</p>
  
  <pre><code>crypt(:password, gen_salt('bf', 8))
  </code></pre>
  
  <p>Likewise for the select I use something like:</p>
  
  <pre><code>crypt(:password, u.password)
  </code></pre>
  
  <p>I want to simplify my SQL code by automating the hash on the table's password column, instead of the SQL queries or additional functions. </p>
  
  <p>To be more clear, when I insert a row in the table, I want it to convert hash/compare immediately. </p>
  
  <p>Is there a way? And if yes, would that be wise? </p>