According to the PostgreSQL docs:
Currently, CHECK expressions cannot contain sub-selects nor refer to variables other than fields of the current row.
Looks like this will probably need a trigger.