Duplicate key

From: Miguel Omar Carvajal <omar(at)carvajal(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Duplicate key
Date: 2002-03-13 02:38:11
Message-ID: 02031221381100.19854@power9.carvajal.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
output.txt text/plain 58.4 KB

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2002-03-13 03:07:07 Re: Dynamic SQL in function
Previous Message David Fetter 2002-03-13 01:21:26 Storing Credit Card Info?