Postgres how to reference FK to primary composite key?
A foreign key constraint can only reference a unique or primary key constraint.
So if your primary key is defined on (id1, id2) and neither id1 nor id2 are unique, there is no way that you can reference the individual columns in a foreign key.
If, on the other hand, id1 and id2 are unique, then one of them should be the primary key, not the combination of both.
It is not clear what you want to achieve, but I'd suspect that the problem goes away when you normalize the tables.