From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Dalton Shane <se401029@cs.may.ie>
Cc: pgsql-sql@postgresql.org
Subject: Re: implementation of a many-to-many relationship
Date: Wed, 27 Feb 2002 07:11:21 -0800 (PST)
Message-ID: <20020227070724.X2599-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <200202271402.OAA23102@cs.may.ie>
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?
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sszabo@megazone23.bigpanda.com, se401029@cs.may.ie
Subject: Re: implementation of a many-to-many relationship
In-Reply-To: <20020227070724.X2599-100000@megazone23.bigpanda.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox