title: How to add a length constraint to a text field
body: <p>It seems it is preferable to use the <code>TEXT</code> datatype when using PostgreSQL (or some other databases which support it as well) rather than <code>character varying(NN)</code> because there is no performance penalty, and the maximum possible length can be adjusted by dropping and re-applying constraints without effecting any views etc. which use the field.</p>
  
  <p>But, how is this constraint applied (SQL code)?</p>