Alexander Farber <[email protected]> writes:
> Unfortunately, I get the error:
> ERROR: 42830: number of referencing and referenced columns for foreign key
> disagree
> How to refer to the (sid, social) FKs properly please?
You have to use the separate-constraint FK syntax:
CREATE TABLE words_payments (
sid text NOT NULL,
social integer NOT NULL ... ,
foreign key (sid, social) references words_social
);
Or in even more pedantic detail:
foreign key (sid, social) references words_social (sid, social)
You'd have to use that if (sid, social) were not the PK of words_social
but just some random unique key.
regards, tom lane
--
Sent via pgsql-general mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general