Subject | Problems with primary key not working |
---|---|
Author | stab_bergbom |
Post date | 2006-03-27T13:58:18Z |
I'm using Firebird 1.5 and have a table desclared as follows:
CREATE TABLE OBJECTS (
OBJECTNAME VARCHAR (30) CHARACTER SET ISO8859_1 NOT NULL COLLATE
ISO8859_1,
ID INTEGER NOT NULL,
OBJECTNUMBER INTEGER NOT NULL,
ENABLED INTEGER NOT NULL);
/* Primary keys definition */
ALTER TABLE OBJECTS ADD PRIMARY KEY (OBJECTNAME);
/* Foreign keys definition */
ALTER TABLE OBJECTS ADD FOREIGN KEY (ID) REFERENCES OBJECTGROUPS
(GROUPID) ON UPDATE CASCADE;
My problem:
It is possible to add more than one record with the same OBJECTNAME
and futhermore changing GROUPID in table OBJECTGROUPS doesn't change
ID in table OBJECTS.
What is wrong? Is the database corrupted and if so what could I do to
fix this?
Thankful for any help
Regards Staffan
CREATE TABLE OBJECTS (
OBJECTNAME VARCHAR (30) CHARACTER SET ISO8859_1 NOT NULL COLLATE
ISO8859_1,
ID INTEGER NOT NULL,
OBJECTNUMBER INTEGER NOT NULL,
ENABLED INTEGER NOT NULL);
/* Primary keys definition */
ALTER TABLE OBJECTS ADD PRIMARY KEY (OBJECTNAME);
/* Foreign keys definition */
ALTER TABLE OBJECTS ADD FOREIGN KEY (ID) REFERENCES OBJECTGROUPS
(GROUPID) ON UPDATE CASCADE;
My problem:
It is possible to add more than one record with the same OBJECTNAME
and futhermore changing GROUPID in table OBJECTGROUPS doesn't change
ID in table OBJECTS.
What is wrong? Is the database corrupted and if so what could I do to
fix this?
Thankful for any help
Regards Staffan