pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Leif B. Kristensen <leif@solumslekt.org>
To: pgsql-sql@postgresql.org
Subject: Strange bug
Date: Tue, 29 Nov 2005 15:31:30 +0100
Message-ID: <200511291531.30441.leif@solumslekt.org> (raw)

I just noticed that I accidentally got a duplicate id. My
definitions are here:

CREATE TABLE citations (
    citation_id         INTEGER PRIMARY KEY,
    source_fk           INTEGER REFERENCES sources (source_id)
);

CREATE TABLE relation_citations (
    relation_fk         INTEGER REFERENCES relations (relation_id)
) INHERITS (citations);

ALTER TABLE relation_citations
    ADD CONSTRAINT source_relation_citation UNIQUE 
    (source_fk, relation_fk);
CREATE INDEX cit_relation_key ON relation_citations (relation_fk);

CREATE TABLE event_citations (
    event_fk            INTEGER REFERENCES events (event_id)
) INHERITS (citations);

ALTER TABLE event_citations
    ADD CONSTRAINT source_event_citation UNIQUE 
    (source_fk, event_fk);
CREATE INDEX cit_event_key ON event_citations (event_fk);

And here is the accident:

pgslekt=> insert into relation_citations values (64062,4578,20017);
INSERT 1478990 1
pgslekt=> insert into relation_citations values (64062,4578,20018);
INSERT 1478991 1

I got an error when I transferred the data to my Web database running 
MySQL:

ERROR 1062 at line 19839 in file: 'ss_relation_citations.sql': Duplicate 
entry '64062' for key 1

How can this happen?
-- 
Leif Biberg Kristensen | Registered Linux User #338009
http://solumslekt.org/ | Cruising with Gentoo/KDE



view thread (7+ messages)  latest in thread

Message-ID: <200511291531.30441.leif@solumslekt.org>
Permalink:  ../200511291531.30441.leif@solumslekt.org/
Also on:    postgresql.org/message-id/200511291531.30441.leif@solumslekt.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: leif@solumslekt.org
  Subject: Re: Strange bug
  In-Reply-To: <200511291531.30441.leif@solumslekt.org>

* 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