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:57 +0100
Message-ID: <439FF2F9.4090809@moonwatcher.it> (raw)
In-Reply-To: <439F137A.6010504@hardgeus.com>
References: <439F0FE8.1050503@moonwatcher.it>
<439F137A.6010504@hardgeus.com>
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
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: <439FF2F9.4090809@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