Creating self-referential FK crashes database (bug-check) whether constraint
violation had place
------------------------------------------------------------------------------------------------
Key: CORE-3925
URL: http://tracker.firebirdsql.org/browse/CORE-3925
Project: Firebird Core
Issue Type: Bug
Components: Engine
Affects Versions: 2.5.1
Environment: Win7x64 / Firebird Win64 SuperServer 2.51 or 2.5.2rc1
Reporter: Dmitry
/*** met this bug during refactoring the legacy database ***/
/*** database is default in IBExpert Dialect 3, UTF-8, SYSDBA/masterkey ****/
/*** Crashing Firebird 2.5.1 Win64 on creating self-referential FK ***/
CREATE DOMAIN T_TEXT_V064 AS
VARCHAR(64) CHARACTER SET WIN1251
COLLATE PXW_CYRL;
CREATE DOMAIN T_TEXT_V256 AS
VARCHAR(255) CHARACTER SET WIN1251
COLLATE PXW_CYRL;
CREATE DOMAIN T_IDLONG AS INTEGER;
COMMIT;
CREATE TABLE EVENTS (
ID_EVENT T_IDLONG NOT NULL ,
EVENT_NAME T_TEXT_V256 NOT NULL COLLATE PXW_CYRL,
ID_RE_EVENT T_IDLONG );
ALTER TABLE EVENTS ADD CONSTRAINT PK_EVENTS PRIMARY KEY (ID_EVENT);
COMMIT;
INSERT into events values (10, 'abcdefgh', 0);
/**** this data was old-style. Should have pre-NULLed ID_RE_EVENT, but did not
noticed it.
Then suddenly... ***/
COMMIT;
update RDB$RELATION_FIELDS set RDB$FIELD_SOURCE = 'T_TEXT_V064'
where (RDB$FIELD_NAME = 'EVENT_NAME') and (RDB$RELATION_NAME = 'EVENTS');
COMMENT ON COLUMN EVENTS.EVENT_NAME IS 'unit IBEvents; const
IB_MAX_EVENT_LENGTH = 64;' ;
COMMIT;
ALTER TABLE EVENTS
ADD CONSTRAINT FK_EVENTS_ANSWERS
FOREIGN KEY (ID_RE_EVENT)
REFERENCES EVENTS(ID_EVENT)
ON DELETE CASCADE
ON UPDATE CASCADE;
commit;
/* violation of FOREIGN KEY constraint "".
violation of FOREIGN KEY constraint "FK_EVENTS_ANSWERS" on table "EVENTS".
Foreign key reference target does not exist. */
rollback;
delete from events;
/* Unsuccessful execution caused by a system error that precludes
successful execution of subsequent statements.
internal gds software consistency check (partner index description not found
(175), file: idx.cpp line: 1346). */
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel