I have a card table where I need to have a constraint, when a user has a card in ACTIVE or LOCKED state a new card shouldn't be created.
CREATE TABLE card
(cardId int,
userId int,
cardState varchar(255));
I tried exploring exclusion using gist exclusion and partial unique index but couldn't make any progress. Any help would be appreciated.
triggerfor that purpose.