Multiple References on one Foreign Key

From: Network Administrator <netadmin(at)vcsn(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Multiple References on one Foreign Key
Date: 2003-04-03 19:18:51
Message-ID: 1049397531.3e8c891be775a@webmail.vcsn.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I hope this is the right place to ask this question. I've search the archives
the news groups and could not find anything so I apologize if this has been
answered previously.

Here is my sample table:

CREATE TABLE master2 (
id int primary key,
name varchar(32),
nickname varchar(32),
unique (name,nickname)
);

This issue is this:

create table reftest2 (
id int primary key,
invited varchar(32),
foreign key (invited) references master2 (name,nickname) on update
cascade on d
elete
cascade
);

This produces the following message:

"ERROR: CREATE TABLE: number of referencing and referenced attributes
for
foreign key disagree"

The idea is that I want to have invited in reftest2 be constrainted
against name
and nickname in the master2 table (actually I really don't want to
"unique
(name,nickname)" in master2, I'd rather have name and nickname be
unique within
themselves if possible)

Is this possible?

--
Keith C. Perry
Director of Networks & Applications
VCSN, Inc.
http://vcsn.com

____________________________________
This email account is being host by:
VCSN, Inc : http://vcsn.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tamir Halperin 2003-04-03 19:21:56 Re: Rules, Triggers something more challenging
Previous Message Tom Lane 2003-04-03 19:17:22 Re: 'DROP INDEX' kills stored rpocedures