I think this is a pretty common problem.
I\'ve got a table user(id INT ...)
and a table photo(id BIGINT, owner INT)
. owner is a reference o
You cannot write such a constraint in a table declaration.
There are some workarounds:
photo_order
column that would keep the order of photos, make (user_id, photo_order)
UNIQUE
, and add CHECK(photo_order BETWEEN 1 AND 10)