title: how to update a primary key in Sql?
body: <p>We have the following table </p>
  
  <p>table1:companies</p>
  
  <pre><code>id_pk | name
  ------+------- 
  1     | company1
  2     | company2
  3     | newcompany
  </code></pre>
  
  <p>id is the primary key</p>
  
  <p>table2:toys</p>
  
  <pre><code>id_pk | name_pk  
  ------+-------
  1     | toy1
  2     | toy2
  </code></pre>
  
  <p>table 2 uses the primary key of table 1 as part of its primary key, </p>
  
  <p>table3:clients</p>
  
  <pre><code>Cid_pk  | name_fk | id_fk
  -------+----------+------
  1x     | toy1     | 1
  2x     | toy2     | 2
  </code></pre>
  
  <p>table 3 uses as foreign key the primary keys of table2, name and id</p>
  
  <p>I have to update all entries of table2 to id=3 but sql doesn't allow me to do that. This is the desired result:</p>
  
  <pre><code>id_pk | name_pk  
  ------+-------
  3     | toy1
  3     | toy2
  
  
  
  Cid_pk  | name_fk | id_fk
  -------+----------+------
  1x     | toy1     | 3
  2x     | toy2     | 3
  </code></pre>
  
  <p>How can I do it? Should I use update cascade? Thanks! </p>