Re: DB design and foreign keys - Mailing list pgsql-sql

From Gianluca Riccardi
Subject Re: DB design and foreign keys
Date
Msg-id 439FF2F9.4090809@moonwatcher.it
Whole thread Raw
In response to Re: DB design and foreign keys  (John McCawley <nospam@hardgeus.com>)
List 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


pgsql-sql by date:

Previous
From: Gianluca Riccardi
Date:
Subject: Re: DB design and foreign keys
Next
From: Gianluca Riccardi
Date:
Subject: Re: DB design and foreign keys