Re: duplicate key violates unique constraint

From: Jim Nasby <decibel(at)decibel(dot)org>
To: Carol Walter <walterc(at)indiana(dot)edu>
Cc: "Spiegelberg, Greg" <gspiegelberg(at)isodxsolutions(dot)com>, <pgsql-admin(at)postgresql(dot)org>
Subject: Re: duplicate key violates unique constraint
Date: 2007-05-10 21:17:41
Message-ID: 7D0DBA1F-6A76-4BEE-B2D5-193180F7B8C3@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On May 10, 2007, at 9:01 AM, Carol Walter wrote:
> And this is more than a question than an answer, but I thought that
> sequences had to designated as data type "serial."

Nope... sequences are actually completely un-related to tables. You
can define a sequence that's not referenced by any table. The serial
data type is essentially a 'macro' that:

Creates a sequence
Sets the default value for the field to be the nextval() of that
sequence
Sets the field to be NOT NULL
--
Jim Nasby jim(at)nasby(dot)net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Peter Koczan 2007-05-10 23:45:38 Re: upgrade 8.0.3 -> 8.2.4
Previous Message zhan deng 2007-05-10 20:17:21 silent installation of PostresSQL