unique constraint

From: "Dominique Bessette - Halsema" <dbhalsema(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: unique constraint
Date: 2008-01-24 18:36:14
Message-ID: b713ca6c0801241036i6c9ea680t21f0ba4e995db735@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm getting the following error, and I think it's because when i insert into
postgres from geoserver's WFS, i first delete then insert the track, and
geoserver does this in succession but very fast. If I personally test
inserting two tracks with the same guid in a row, then it works, but because
geoserver is going so fast it blows up and gives this error. i'm looking
into fixing it another way but does any one have an idea of anything i can
do to avoid this error in postgres?

STATEMENT: INSERT INTO "public"."tracks"
("guid","classification","creationtimestamp","lastupdatetime","effectivetime","reportedtime","staletime","confidencevalue","behavioridentity","nationality","classificationcategory","classconfidencevalue","axislabels","uomlabels","aoumajaxis","aouminaxis","aouvalid","the_geom")
VALUES ('OOSTZEE','U','2008-01-22T21:05:15.366Z','2008-01-22T21:05:15.366Z
','2008-01-22T21:05:15.366Z','2008-01-22T21:05:15.366Z','2008-01-22T21:05:
15.366Z',1.0,'FRIEND','','SEA','1.0','Lat Long h','degree
degree',9999999,9999999,'true',setSRID('00000000014029D8E757928E0D404B9C28CBD1244A'::geometry,4326))

ERROR: duplicate key violates unique constraint "tracks_guid_key"

Track=# \d tracks
Table "public.tracks"
Column | Type | Modifiers
------------------------+-------------------+------------------------------------------------------
sid | integer | not null default
nextval('tracks_sid_seq'::regclass)
guid | character varying | not null
classification | character varying |
creationtimestamp | character varying |
lastupdatetime | character varying |
effectivetime | character varying |
reportedtime | character varying |
staletime | character varying |
confidencevalue | numeric |
behavioridentity | character varying |
nationality | character varying |
classificationcategory | character varying |
classconfidencevalue | character varying |
axislabels | character varying |
uomlabels | character varying |
aoumajaxis | numeric |
aouminaxis | numeric |
aouvalid | character varying |
the_geom | geometry |
Indexes:
"tracks_pkey" PRIMARY KEY, btree (sid)
"tracks_guid_key" UNIQUE, btree (guid)
"tracks_the_geom_gist" gist (the_geom)
Check constraints:
"enforce_geotype_the_geom" CHECK (geometrytype(the_geom) = 'POINT'::text
OR the_geom IS NULL)
"enforce_srid_the_geom" CHECK (srid(the_geom) = 4326)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-01-24 18:48:30 Re: REINDEX on large DB vs. DROP INDEX/CREATE INDEX
Previous Message Robert Fitzpatrick 2008-01-24 18:35:13 Re: Getting all tables into memory