title: Why is there an error for a character limit of 255 on text field in PostgreSQL?
body: <p>After finding 2 SO questions related to string vs. text fields, I discovered that the link field <strong><em>is already</em></strong> text:</p>
  
  <pre><code>create_table "answers", :force =&gt; true do |t|
    t.string   "text"
    t.text     "link"
  </code></pre>
  
  <p>Why is Postgres throwing the following error:</p>
  
  <pre><code>ActiveRecord::StatementInvalid: PG::Error: ERROR:  value too long for type character varying(255)
  </code></pre>
  
  <p>I tried a migration <code>change_column :answers, :link, :text, :limit =&gt; nil</code> but I don't think that does anything.</p>
  
  <p>Edit: So, the problem is that the schema says the field is text, but actually it is string:</p>
  
  <pre><code>Answer.new.column_for_attribute('link').type
  =&gt; :string
  </code></pre>
  
  <p>What is the best way to fix it? By rebuilding the database from the schema? By changing it to string and then back to text?</p>
  
  <p>Rails 3.2.2, Postgres 9, Heroku.</p>