Re: standard IDENTITY support (Was: Re: SERIAL type not autoincremented)

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Markus Bertheau <twanger(at)bluetwanger(dot)de>
Cc: teknet(at)poczta(dot)onet(dot)pl, pgsql-admin(at)postgresql(dot)org
Subject: Re: standard IDENTITY support (Was: Re: SERIAL type not autoincremented)
Date: 2004-07-06 05:04:39
Message-ID: 20040706050439.GA13797@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Mon, Jul 05, 2004 at 01:42:35 +0200,
Markus Bertheau <twanger(at)bluetwanger(dot)de> wrote:
> ?? ??????, 02.07.2004, ?? 19:22, teknet(at)poczta(dot)onet(dot)pl ??????????:
> > Hello
> > i have:
> > create table student(
> > id SERIAL NOT NULL,
> > name VARCHAR(35) NOT NULL,
> > primary key (id)
> > );
> >
> > and when i try to insert like this:
> > insert into student (name) values('me');
> > i receive error:
> > ERROR: duplicate key violates unique constraint "student_pkey"
>
> Is this scenario possible in standard SQL identity columns? From what I
> read here[1], a standard IDENTITY column can guarantee successful
> insertion of a unique key. Is there similar support planned for
> PostgreSQL?

I don't expect things are going to change. However it isn't a problem
if you always use DEFAULT to generate the value to be inserted and
that you use bigserial if you need more than 2 billion (2^31) values.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Daniel Rubio 2004-07-06 09:06:25 Upgrade problems with OID type ...
Previous Message Bruce Momjian 2004-07-06 02:27:13 Re: How to list what queries are running in postgres?