As Erwin Brandstetter stated here
Rules for FK constraints
To answer the question in the title and at the end of your text:
"I would still like to know how to have one foreign key referencing two primary keys."
That's impossible.
A FOREIGN KEY
constraint can only point to one table and each table can only have one PRIMARY KEY
constraint.
Or you can have multiple FOREIGN KEY
constraints on the same column(s) referencing one PRIMARY KEY
of a (different) table each. (Rarely useful.)
However, a single PK or FK can span multiple columns.
And a FK can reference any explicitly defined unique (set of) column(s) in the target, not just the PK. The manual:
A foreign key must reference columns that either are a primary key or form a unique constraint.
A multicolumn PK or UNIQUE
constraint can only be referenced by a multicolumn FK constraint with matching column types.
Basic advice: