Subject | I cannot inactivate foreign index |
---|---|
Author | Andy Canfield |
Post date | 2001-08-30T12:24:39Z |
I am trying to inactivate the index that Firebird automatically provides for foreign keys that reference other tables. I get an error saying that I cannot deactivate a primary key index. But it isn't a primary key index.
The SQL statement in question is:
ALTER INDEX RDB$FOREIGN23 INACTIVE ;
The diagnostic is:
*** Failure of isc function = "isc_dsql_execute"
--unsuccessful metadata update
--MODIFY RDB$INDICESS failed
--action cancelled by trigger (3) to preserve data integrity
--Cannot deactivate primary index
Here is the information from the table RDB$INDICES:
RDB$INDEX_NAME = RDB$FOREIGN23
RDB$RELATION_NAME = ANNUALFARMER
RDB$INDEX_ID = 3
RDB$UNIQUE_FLAG = 0
RDB$DESCRIPTION = (null)
RDB$SEGMENT_COUNT = 1
RDB$INDEX_INACTIVE = 0
RDB$INDEX_TYPE = 0
RDB$FOREIGN_KEY = RDB$PRIMARY21
RDB$SYSTEM_FLAG = (null)
RDB$EXPRESSION_BLR = (null)
RDB$EXPRESSION_SOURCE = (null)
RDB$STATISTICS = 0
[by the way, Ann, you have taught us that null means 'unknown', yet yere in a sytem table we have null meaning unknown (description), null meaning false (system_flag), and null meaning does not exist (expression_blr).]
Here is the information from the table RDB$INDEX_SEGMENTS
INDEX_NAME = RDB$FOREIGN23
FIELD_NAME = ADAMSFARMERIDENT
FIELD_POSITION = 0
Here is the DDL for the ANNUALFARMER table:
create domain SEASONID as INTEGER
check ( VALUE > 1990 and value < 2099 ) ; /* year */
create table ANNUALFARMER (
SEASONIDENT
SEASONID
not null,
FARMERIDENT
FARMERID
not null,
ADAMSFARMERIDENT
ADAMSFARMERID,
TAG
NUMBER,
foreign key (
ADAMSFARMERIDENT )
references ADAMSFARMER );
create unique index AFI1 on ANNUALFARMER ( SEASONIDENT, FARMERIDENT );
create unique index AFI2 on ANNUALFARMER ( SEASONIDENT, ADAMSFARMERIDENT );
The table in question does not even have a primary key! I am trying to inactivate the index on table ANNUALFARMER column ADAMSFARMERIDENT, and Firebird tells me that it is a primary key index and I am not allowed to inactivate it.
Is the program flawed in it's error message ( which should read "Cannot deactivate foreign key index" )? Is it perhaps confused by the table not having a primary key? Is it some other glitch?
Is there some way to prevent Firebird from wasting time updating an useless index, short of giving up on "FOREIGN KEY" entirely? I want the metadata to retain the declaration of the interrelationship between the two tables.
The SQL statement in question is:
ALTER INDEX RDB$FOREIGN23 INACTIVE ;
The diagnostic is:
*** Failure of isc function = "isc_dsql_execute"
--unsuccessful metadata update
--MODIFY RDB$INDICESS failed
--action cancelled by trigger (3) to preserve data integrity
--Cannot deactivate primary index
Here is the information from the table RDB$INDICES:
RDB$INDEX_NAME = RDB$FOREIGN23
RDB$RELATION_NAME = ANNUALFARMER
RDB$INDEX_ID = 3
RDB$UNIQUE_FLAG = 0
RDB$DESCRIPTION = (null)
RDB$SEGMENT_COUNT = 1
RDB$INDEX_INACTIVE = 0
RDB$INDEX_TYPE = 0
RDB$FOREIGN_KEY = RDB$PRIMARY21
RDB$SYSTEM_FLAG = (null)
RDB$EXPRESSION_BLR = (null)
RDB$EXPRESSION_SOURCE = (null)
RDB$STATISTICS = 0
[by the way, Ann, you have taught us that null means 'unknown', yet yere in a sytem table we have null meaning unknown (description), null meaning false (system_flag), and null meaning does not exist (expression_blr).]
Here is the information from the table RDB$INDEX_SEGMENTS
INDEX_NAME = RDB$FOREIGN23
FIELD_NAME = ADAMSFARMERIDENT
FIELD_POSITION = 0
Here is the DDL for the ANNUALFARMER table:
create domain SEASONID as INTEGER
check ( VALUE > 1990 and value < 2099 ) ; /* year */
create table ANNUALFARMER (
SEASONIDENT
SEASONID
not null,
FARMERIDENT
FARMERID
not null,
ADAMSFARMERIDENT
ADAMSFARMERID,
TAG
NUMBER,
foreign key (
ADAMSFARMERIDENT )
references ADAMSFARMER );
create unique index AFI1 on ANNUALFARMER ( SEASONIDENT, FARMERIDENT );
create unique index AFI2 on ANNUALFARMER ( SEASONIDENT, ADAMSFARMERIDENT );
The table in question does not even have a primary key! I am trying to inactivate the index on table ANNUALFARMER column ADAMSFARMERIDENT, and Firebird tells me that it is a primary key index and I am not allowed to inactivate it.
Is the program flawed in it's error message ( which should read "Cannot deactivate foreign key index" )? Is it perhaps confused by the table not having a primary key? Is it some other glitch?
Is there some way to prevent Firebird from wasting time updating an useless index, short of giving up on "FOREIGN KEY" entirely? I want the metadata to retain the declaration of the interrelationship between the two tables.