Re: implementation of a many-to-many relationship - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: implementation of a many-to-many relationship
Date
Msg-id 20020227070724.X2599-100000@megazone23.bigpanda.com
Whole thread Raw
In response to implementation of a many-to-many relationship  (Dalton Shane <se401029@cs.may.ie>)
Responses Re: implementation of a many-to-many relationship  ("Dan Langille" <dan@langille.org>)
List pgsql-sql
On Wed, 27 Feb 2002, Dalton Shane wrote:

> I need to implement a many-to-many relationship in PostgreSQL but don't know how
> to. I've trawled through the mailing lists but can't find anything, it's very
> easy to do in Access so it can't be that hard in PostgreSQL.
>
> I created a linking table between two tables (voter, candidates) called
> c_voting, I then reference the two table's primary keys to create a composite
> primary key for c_voting.
>
> However when I go to input data into c_voting I get a referential integrity
> error saying that the primary key of table voter doesn't match primary key of
> c_voting (which it shouldn't).

Are you sure that's what it said?  I could see it saying something like
key referenced from c_voting not found in voter, but that'd make sense
if you were trying to insert a v_number that didn't exist in voter.

What version are you running?  I tried the below in 7.2 and don't see
anything particularly wierd happening.
Can you give a sample set of inserts that you're trying and having fail?




pgsql-sql by date:

Previous
From: otisg@ivillage.com
Date:
Subject: Re: Err. compiling func. with SET TRANS...
Next
From: "Dan Langille"
Date:
Subject: Re: implementation of a many-to-many relationship