title: How to write a constraint concerning a max number of rows in postgresql?
body: <p>I think this is a pretty common problem.</p>
  
  <p>I've got a table <code>user(id INT ...)</code> and a table <code>photo(id BIGINT, owner INT)</code>. owner is a reference on <code>user(id)</code>.</p>
  
  <p>I'd like to add a constraint to the table photo that would prevent more than let's say 10 photos to enter the database for each users.</p>
  
  <p>What's the best way of writing this?</p>
  
  <p>Thx!</p>