Duplicate key - Mailing list pgsql-general

From Miguel Omar Carvajal
Subject Duplicate key
Date
Msg-id 02031221381100.19854@power9.carvajal.com
Whole thread Raw
List pgsql-general
Hi all,

   I am having a problem with PostgreSQL 7.1.3 using Redhat 7.1 and it is the
following: I have a program I am making in C++ that is sending four simple
insert commands to postgres and I keep getting an "ERROR:  Cannot insert a
duplicate key into unique index dbshpawb001"(this is what I see when I put
postmaster in debug level 4, see attached file.) the inserts are:

insert into dbshpawb

("courier_id","pos_shipper","pos_recipient","manifest_no","pos_sender","bill_no","pckg_no","status","cap_user","cap_time","cap_date","upd_user","upd_time","upd_date","pckgs","container_no","package_no","real_weight","weight_units")


values('2','3','5','25','3','234','1','A','29','08:55:01PM','03/12/02','29','08:55:01PM','03/12/02','1','1','1','10','P');insert

into dbshpawb

("courier_id","pos_shipper","pos_recipient","manifest_no","pos_sender","bill_no","pckg_no","status","cap_user","cap_time","cap_date","upd_user","upd_time","upd_date","pckgs","container_no","package_no","real_weight","weight_units")


values('2','3','5','25','3','235','1','A','29','08:55:01PM','03/12/02','29','08:55:01PM','03/12/02','1','1','2','4','P');
insert into dbshpawb

("courier_id","pos_shipper","pos_recipient","manifest_no","pos_sender","bill_no","pckg_no","status","cap_user","cap_time","cap_date","upd_user","upd_time","upd_date","pckgs","container_no","package_no","real_weight","weight_units")


values('2','3','5','25','3','236','1','A','29','08:55:02PM','03/12/02','29','08:55:02PM','03/12/02','1','1','3','20','P');insert

into dbshpawb

("courier_id","pos_shipper","pos_recipient","manifest_no","pos_sender","bill_no","pckg_no","status","cap_user","cap_time","cap_date","upd_user","upd_time","upd_date","pckgs","container_no","package_no","real_weight","weight_units")


values('2','3','5','25','3','237','1','A','29','08:55:02PM','03/12/02','29','08:55:02PM','03/12/02','1','1','4','90','P');

the table structure is:

CREATE TABLE "dbshpawb" (
      "courier_id" int4,
      "pos_shipper" int2,
      "pos_recipient" int2,
      "manifest_no" int4,
      "pos_sender" int2,
      "bill_no" int4,
      "status" char(1),
      "cap_user" int8,
      "cap_date" date,
      "cap_time" time,
      "upd_user" int8,
      "upd_date" date,
      "upd_time" time,
      "pckgs" int2,
      "container_no" int2 default 0,
      "package_no" int2 default 0,
      "real_weight" real default 0,
      "weight_units" char(1),
      "pckg_no" int2 default 0
);
CREATE UNIQUE INDEX "dbshpawb001" on "dbshpawb" using btree (
        "courier_id" "int4_ops",
        "pos_shipper" "int2_ops",
        "pos_recipient" "int2_ops",
        "manifest_no" "int4_ops",
        "container_no" "int2_ops",
        "pos_sender" "int2_ops",
        "bill_no" "int4_ops"
);

can someone please shed some light on what I am doing wrong?

Thanks in advance,
Omar Carvajal

Attachment

pgsql-general by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: missing greatbridge / database session monitor
Next
From: Jean-Michel POURE
Date:
Subject: Re: Export a database or a table from a database