title: Apply postgreSQL trigger to existing rows in database
body: <p>I am using PostgeSQL 9.2.2. My database schema is </p>
  
  <pre><code>pg_rocks_post
  
   title                        | character varying(1024) | not null
   body                         | text                    | not null
   body_title_tsv               | tsvector                |
   body_title_titleupweight_tsv | tsvector                |
  </code></pre>
  
  <p>I created the body_title_titleupweight_tsv as a type tsvector.
  I then defined a trigger using the examples in the documentation which up weighted the title as follows.</p>
  
  <pre><code>pgdj=# CREATE FUNCTION title_upweight_trigger() RETURNS trigger AS $$
  begin
  new.body_title_titleupweight_tsv :=
  setweight(to_tsvector('pg_catalog.english', coalesce(new.title,'')), 'A') ||
  setweight(to_tsvector('pg_catalog.english', coalesce(new.body,'')), 'D');
  return new;
  end
  $$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>I know the trigger works because when I update an entry in the pg_rocks_post and then query it : I see that it has correctly populated the body_title_titleupweight_tsv ts_vector with that updated row.</p>
  
  <p>My Question is how do I have it apply the trigger to the existing rows in my table. I am only learning postgres and so have a few hundred entries in my test database and want to know how to populate the body_title_titleupweight_tsv column.</p>
  
  <p>I think one way to do this would be to run an update and write the function all over with something like</p>
  
  <pre><code>pgdj=# UPDATE pg_rocks_post SET body_title_titleupweight_tsv =
  setweight(to_tsvector( coalesce(title,'')),'A') ||
  setweight(to_tsvector(coalesce(body,'')),'D');
  </code></pre>
  
  <p>Instead of re writing the logic for the trigger again in the update statement above. Is there a way to trigger the trigger above by doing a dummy update or a "touch" style operation that flips the trigger on all rows in the database.</p>
  
  <p>I tried looking for syntax or examples of such dummy or "touch" type operations and could not find any that explained how to do this.</p>