By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
ERROR: conflicting key value violates exclusion constraint "resources_org_id_source_id_excl" DETAIL: Key (org_id, source_id)=(11, 2002) conflicts with existing key (org_id, source_id)=(11, 1001).
| id | org_id | source_id | data |
|---|---|---|---|
| 1 | 11 | 1001 | {} |
| 2 | 22 | 2002 | {} |
| 3 | 33 | 3003 | {} |
| 4 | 11 | 1001 | {} |
SELECT 4