Subject Insert succesfull while violating primary key constraint
Author olivier_olmer
We experienced succesful inserts in the database while it is
violating the primary key constraint.
This appeared using firebird 1.02 with multiple files. Even after
backup restore this still is the case.

This problem does not appear till we dropped some foreign key
constraints by its name.

Two questions:
How do I solve the problem of deleting the double records (since they
are exactly the same?
Which version of firebird is reliable on testing the primary key
constraint.

With kind regards,

Olivier Olmer

Background info:

Here is my metadata retrieved using ibadmin:
CREATE TABLE ORDERS (
ORDERID ORDERID NOT NULL,
ORDERNR ORDERNR ,
KLANTID KLANTID ,
ORDREF ORDREF ,
CREATIONDATE CREATIONDATE ,
CHANGEDDATE CHANGEDDATE ,
ORDERSTATUSID ORDERSTATUSID DEFAULT 10,
CONSTRAINT PKORDERID PRIMARY KEY (ORDERID)
);

ALTER TABLE ORDERS ADD CONSTRAINT FKORDERSKLANTID FOREIGN KEY
(KLANTID) REFERENCES KLANTEN(KLANTID);
ALTER TABLE ORDERS ADD CONSTRAINT FKORDERSTATUS FOREIGN KEY
(ORDERSTATUSID) REFERENCES ORDERSTATUS(ORDERSTATUSID);
ALTER TABLE ORDERS ADD CONSTRAINT CHECKORDERNRNOTNULL CHECK (ordernr
is not null);
ALTER TABLE ORDERS ADD CONSTRAINT CHECKORDERNRNOTNUL CHECK
(ordernr<>0);
CREATE INDEX IDXORDERSORDERNR ON ORDERS(ORDERNR);

***********INSERT INTO orders(
ORDERID, ORDERNR, KLANTID, ORDREF, CREATIONDATE, CHANGEDDATE,
ORDERSTATUSID)
VALUES (

2000, 211930, 117, '---', '2001-08-24 14:50:15', '2001-08-24
15:27:55', 20);
INSERT INTO orders(
ORDERID, ORDERNR, KLANTID, ORDREF, CREATIONDATE, CHANGEDDATE,
ORDERSTATUSID)
VALUES (

2000, 211930, 117, '---', '2001-08-24 14:50:15', '2001-08-24
15:27:55', 20);

select * from orders where orderid=2000 result in the above records.