pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Patrick Coulombe <pcoulombe@mediacces.com>
To: pgsql-sql@postgresql.org
Subject: duplicate key
Date: Mon, 22 May 2000 00:50:19 -0400
Message-ID: <3928BC8B.9C2CF63@mediacces.com> (raw)

hi,

medias=> insert into medias (name, location) values ('BLABLA',
'Montreal');
ERROR:  Cannot insert a duplicate key into a unique index


Here's my database & tables :

Database    = medias
+------------------+----------------------------------+----------+
|  Owner           |             Relation             |   Type   |
+------------------+----------------------------------+----------+
| postgres         | medias                           | table    |
| postgres         | medias_media_id_key              | index    |
| postgres         | medias_media_id_seq              | sequence | 
+------------------+----------------------------------+----------+

Table    = medias
+----------------------------------+----------------------------------+-------+
|              Field               |      Type          	      | Length|
+----------------------------------+----------------------------------+-------+
| media_id                         | int4 not null default nextval('"
|     4 |
| name                             | text not null                   
|   var |
| location                         | text                            
|   var |
+----------------------------------+----------------------------------+-------+


I don't specify a value to media_id, so why i got this error? It's
supposed to increment by itself (media_id serial). But, i have to say
that i import the data in medias with the function copy from... i import
also media_id information. Maybe now, i cannot add because my
medias_media_id_seq do not correspond to my new "importation". How can I
fix that?

Thank you very very much and once again sorry for my english.
Patrick



view thread (3+ messages)  latest in thread

Message-ID: <3928BC8B.9C2CF63@mediacces.com>
Permalink:  ../3928BC8B.9C2CF63@mediacces.com/
Also on:    postgresql.org/message-id/3928BC8B.9C2CF63@mediacces.com

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: pcoulombe@mediacces.com
  Subject: Re: duplicate key
  In-Reply-To: <3928BC8B.9C2CF63@mediacces.com>
  References: <3928BC8B.9C2CF63@mediacces.com>

* 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