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