title: Why is it not good to have a primary key on a join table?
body: <p>I was watching a screencast where the author said it is not good to have a primary key on a join table but didn't explain why. </p>
  
  <p>The join table in the example had two columns defined in a Rails migration and the author added an index to each of the columns but no primary key. </p>
  
  <p>Why is it not good to have a primary key in this example?</p>
  
  <pre><code>create_table :categories_posts, :id =&gt; false do |t|
    t.column :category_id, :integer, :null =&gt; false
    t.column :post_id, :integer, :null =&gt; false
  end
  add_index :categories_posts, :category_id
  add_index :categories_posts, :post_id
  </code></pre>
  
  <p>EDIT: As I mentioned to Cletus, I can understand the potential usefulness of an auto number field as a primary key even for a join table. However in the example I listed above, the author explicitly avoids creating an auto number field with the syntax ":id => false" in the "create table" statement. Normally Rails would automatically add an auto-number id field to a table created in a migration like this and this would become the primary key. But for this join table, the author specifically prevented it. I wasn't sure why he decided to follow this approach.</p>