How to write a constraint concerning a max number of rows in PostgreSQL?
I've got a table user(id INT ...) and a table photo(id BIGINT, owner INT). owner is a reference on user(id).
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.
What's the best way of writing this?