Re: Table design - postgresql solution - Mailing list pgsql-general

From rsmogura@softperience.pl
Subject Re: Table design - postgresql solution
Date
Msg-id 1e6057b14cec13858da1d374f9f1ec5c.squirrel@softperience.eu
Whole thread Raw
In response to Table design - postgresql solution  (Miguel Vaz <pagongski@gmail.com>)
List pgsql-general
> Hi,
>
> I have a bit of a DB design question, associated with postgresql in
> particular, hopefully thinking it could solve my dilemma.
>
> This is my setup of 3 tables:
>
> Table_1
> id_t1
> name
> date_of_discovery
> history
>
> Table_2
> id_t2
> name
> type
> size
>
> Table_3
> id_t3
> name
> location
> color
>
> I want a solution (table or groups of tables) where i can establish
> relations between items of every table, for example:
>
> row with id=2 from Table_1 is connected to row with id=23 from Table_3
> id=9(from Table_2) is connected to id=83(from Table_1)

The common in many to many relations is to create for each two tables
"joining" table
tab1_tab2 with corresponding foreign keys to tab_1 and tab_2.

If you want make general relation table, to keep all relations try with
CHECK CONSTRAINT with own function inside.


pgsql-general by date:

Previous
From: Stefan Keller
Date:
Subject: Re: One-click Installers for 9.1 Alpha 2 (ETA)
Next
From: John R Pierce
Date:
Subject: an enhancement idea