Re: DB design and foreign keys

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:57
Message-ID: 439FF2F9.4090809@moonwatcher.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

John McCawley wrote:

> Table orders defines the column order_code as a serial, which simple
> makes a trigger which gives a new value to the column on insert. Note
> that there is NO guarantee that ths column will be unique. You can
> manually update the value to whatever you want. If you wish this
> column to be unique, you must specify it on creation, or later do an
> alter table add constraint to the column.
>
> A foreign key requires that the referenced column be unique (DB
> enforced, not just coincidentally unique), and that' s why your table
> creation is failing.

[cut]

that was my misunderstanding

thanks for your reply,
Gianluca Riccardi

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Gianluca Riccardi 2005-12-14 10:25:50 Re: DB design and foreign keys
Previous Message Gianluca Riccardi 2005-12-14 10:24:41 Re: DB design and foreign keys