Skip site navigation (1) Skip section navigation (2)

Re: Multitable uniqueness ?

From: Jean-Luc Lachance <jllachan(at)sympatico(dot)ca>
To: Andreas <maps(dot)on(at)gmx(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Multitable uniqueness ?
Date: 2004-05-26 14:00:29
Message-ID: (view raw or whole thread)
Lists: pgsql-sql
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 (, 
> 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 into the stalls-table ?
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings

In response to


pgsql-sql by date

Next:From: Manuel SugawaraDate: 2004-05-26 15:20:50
Subject: Re: trigger function building
Previous:From: Jan WieckDate: 2004-05-26 13:56:17
Subject: Re: Multitable uniqueness ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group