From: Gianluca Riccardi <ml-reader@moonwatcher.it>
To: pgsql-sql@postgresql.org
Subject: Re: DB design and foreign keys
Date: Wed, 14 Dec 2005 11:24:41 +0100
Message-ID: <439FF2E9.5040405@moonwatcher.it> (raw)
In-Reply-To: <8787.1134498689@sss.pgh.pa.us>
References: <439F0FE8.1050503@moonwatcher.it>
<8787.1134498689@sss.pgh.pa.us>
[cut]
> order_code is not by itself unique --- SERIAL doesn't guarantee that.
>
>
that was my misunderstanding, i thought (misunderstood) that 'serial'
implied 'unique'
> I'm not sure why you are declaring the primary key of orders as being
> the combination of *two* serial columns,
i thought it was good design choice and even needed for foreign keys
referencing on them
> but if that's what you really
> need
>
i'm not shure about that
> and you also want to be able to reference a row by just one of
> them, you'll need to apply a separate unique constraint to just the
> order_code column.
>
>
sorry, i'm afraid i didn't understand: are you suggesting to apply the
constraint in case the primary key is kept on the combination of the two
serial columns? or to remove the primary key of the two serial columns?
> regards, tom lane
>
>
thanks a lot for your kind response, best regards,
Gianluca Riccardi
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: ml-reader@moonwatcher.it
Subject: Re: DB design and foreign keys
In-Reply-To: <439FF2E9.5040405@moonwatcher.it>
* 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