From: | Gianluca Riccardi <ml-reader(at)moonwatcher(dot)it> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: DB design and foreign keys |
Date: | 2005-12-14 10:24:41 |
Message-ID: | 439FF2E9.5040405@moonwatcher.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
[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
From | Date | Subject | |
---|---|---|---|
Next Message | Gianluca Riccardi | 2005-12-14 10:24:57 | Re: DB design and foreign keys |
Previous Message | Magnus Hagander | 2005-12-14 09:15:31 | Re: Multi-row update w. plpgsql function |