Why doesn't the SERIAL data type automatically have a UNIQUE CONSTRAINT

From: Ferindo Middleton Jr <fmiddleton(at)verizon(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Why doesn't the SERIAL data type automatically have a UNIQUE CONSTRAINT
Date: 2005-09-27 00:45:18
Message-ID: 4338961E.20100@verizon.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Is there some reason why the SERIAL data type doesn't automatically have
a UNIQUE CONSTRAINT. It seems that the main reason for using it is so
that the value for this field keeps changing automatically and is never
null so any one record can be identified using it- So why not imply that
it is always be UNIQUE anyway. I mean, if you were to force another
value on a SERIAL field that already had that same value, the would
through the sequence tracking the the fields current value off any way,
so it just makes sense to me to not let a serial field be duplicated.
Let's take a poll. Is there anyone out there who actually uses the
SERIAL data type who would not want it to be UNIQUE?

Ferindo

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Anthony Molinaro 2005-09-27 00:58:40 Re: how to do 'deep queries'?
Previous Message Stewart Ben (RBAU/EQS4) * 2005-09-27 00:45:13 Re: how to do 'deep queries'?