Re: Why doesn't the SERIAL data type automatically have a

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, fmiddleton(at)verizon(dot)net, pgsql-sql(at)postgresql(dot)org
Subject: Re: Why doesn't the SERIAL data type automatically have a
Date: 2005-10-04 22:52:50
Message-ID: 20051004225250.GN40138@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, Sep 27, 2005 at 10:33:14AM -0500, Scott Marlowe wrote:
> On Mon, 2005-09-26 at 20:03, Tom Lane wrote:
> > Ferindo Middleton Jr <fmiddleton(at)verizon(dot)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 ...
>
> I have to admit, right after the change was made, I was of the opinion
> that no one would ever need that. Then, a few months later, it was
> exactly what I needed for some project... :)

Arguably it would have been better to make the default case add either
UNIQUE or PRIMARY KEY with a way to over-ride.

If newbies are getting burned maybe it would be useful to toss a NOTICE
or maybe even WARNING when a serial is created without a unique
constraint of some kind?
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2005-10-04 23:23:23 Re: Why doesn't the SERIAL data type automatically have a
Previous Message Jim C. Nasby 2005-10-04 22:34:50 Re: Help with multistage query