Skip site navigation (1) Skip section navigation (2)

Re: duplicate key violates unique constraint

From: Carol Walter <walterc(at)indiana(dot)edu>
To: Jim Nasby <decibel(at)decibel(dot)org>
Cc: "Spiegelberg, Greg" <gspiegelberg(at)isodxsolutions(dot)com>, <pgsql-admin(at)postgresql(dot)org>
Subject: Re: duplicate key violates unique constraint
Date: 2007-05-11 13:23:38
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
Yes, I've seen "serial" used in other places than the primary key,  
but I was referring to Greg's output.  The data type for the sequence  
is listed as "bigint".  My thought was that the data type was listed  
as "serial" for sequences.  I just looked at my database and I was  
wrong about that.  It does list the data type as an integer when you  
"describe" the table.


On May 10, 2007, at 5:17 PM, Jim Nasby wrote:

> 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      512.569.9461 (cell)

In response to

pgsql-admin by date

Next:From: Spiegelberg, GregDate: 2007-05-11 13:33:22
Subject: Re: duplicate key violates unique constraint
Previous:From: Steve HoldowayDate: 2007-05-11 01:10:27
Subject: Re: upgrade 8.0.3 -> 8.2.4

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group