[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
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster