Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id B0D6347614D for ; Wed, 27 Feb 2002 10:11:11 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id E427CD5F7; Wed, 27 Feb 2002 07:11:21 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id D7A785BFB; Wed, 27 Feb 2002 07:11:21 -0800 (PST) Date: Wed, 27 Feb 2002 07:11:21 -0800 (PST) From: Stephan Szabo To: Dalton Shane Cc: Subject: Re: implementation of a many-to-many relationship In-Reply-To: <200202271402.OAA23102@cs.may.ie> Message-ID: <20020227070724.X2599-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200202/432 X-Sequence-Number: 6853 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?