From: Jean-Luc Lachance <jllachan@sympatico.ca>
To: Andreas <maps.on@gmx.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Multitable uniqueness ?
Date: Wed, 26 May 2004 10:00:29 -0400
Message-ID: <40B4A2FD.8030004@sympatico.ca> (raw)
In-Reply-To: <40B40B4A.4050908@gmx.net>
References: <40B40B4A.4050908@gmx.net>
Do you really need MANY-TO-MANY between customers and projects?
I can see customers owning many projects, but do you really have
projects belonging to many customers?
If not, fold cust_proj into projects.
Otherwise, UNIQUE (cp_id, stall_no) on stalls should be enough.
Andreas wrote:
> Hi folks,
>
> Is there a way to have something like this : UNIQUE (table_1.id,
> table_2.xxx)
>
> I got some tables that have a couple of foreign keys. Now I try to
> minimize those relationships to clean up the mess. :-}
> We do business fairs. (???) Like c-bit only a few magnitudes smaller.
> So we have projects and rent stalls to customers.
>
> customers (c_id, ...)
> projects (p_id,...)
>
> there is an relation cust_proj (cp_id, c_fk, p_fk, status_fk)
> with a UNIQUE constraint (c_fk, p_fk)
>
> A customer can have several orders, contacts, ... tied to a project.
>
> Those look like this stalls (stall_id, cp_id, stall_no, ...)
> o_id PRIMARY
> cp_fk FOREIGN KEY that ties to custmer and project
>
> stall_no is a varchar
> It should be unique within a project.
>
> Will I have to integrate the project.id into the stalls-table ?
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>
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: jllachan@sympatico.ca, maps.on@gmx.net
Subject: Re: Multitable uniqueness ?
In-Reply-To: <40B4A2FD.8030004@sympatico.ca>
* 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