From: Ferindo Middleton Jr <fmiddleton@verizon.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Why doesn't the SERIAL data type automatically have a UNIQUE
Date: Mon, 26 Sep 2005 22:53:25 -0400
Message-ID: <4338B425.1010002@verizon.net> (raw)
In-Reply-To: <5899.1127782998@sss.pgh.pa.us>
References: <4338961E.20100@verizon.net>
<5899.1127782998@sss.pgh.pa.us>
You're right, Tom. I'm sure someone has a use for a serial field that
isn't unique. I just assumed that it was. I guess I didn't read the
documentation closely enough. At any rate, I had a table using a serial
field that I had to restore to a previous date when I noticed that I
forgot to set the sequence to the most recent value... user continued
adding data to this table and it started causing some problems. It just
seems like most situations would want it unique... to ensure integrity.
But I guess you need to choose constraint for built-in data types that
follow more of a one-size-fits-all philosophy. And hey, how hard can
it be to add the word UNIQUE when I'm creating tables?
Ferindo
Tom Lane wrote:
> Ferindo Middleton Jr <fmiddleton@verizon.net> writes:
>
>> Is there some reason why the SERIAL data type doesn't automatically have
>> a UNIQUE CONSTRAINT.
>>
>
> It used to, and then we decoupled it. I don't think "I have no use for
> one without the other" translates to an argument that no one has a use
> for it ...
>
> regards, tom lane
>
>
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: fmiddleton@verizon.net, tgl@sss.pgh.pa.us
Subject: Re: Why doesn't the SERIAL data type automatically have a UNIQUE
In-Reply-To: <4338B425.1010002@verizon.net>
* 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