есть 2 таблицы
Код: Выделить всё
CREATE TABLE TABLE1 (
ID INTEGER NOT NULL,
TM TIMESTAMP
);
ALTER TABLE TABLE1 ADD CONSTRAINT PK_TABLE1 PRIMARY KEY (ID);
/***************************/
CREATE TABLE TABLE2 (
FID INTEGER,
TM TIMESTAMP
);
ALTER TABLE TABLE2 ADD CONSTRAINT FK_TABLE2_1 FOREIGN KEY (FID) REFERENCES TABLE1 (ID);
Код: Выделить всё
insert into table1 (id, tm) values (1, current_timestamp);
insert into table1 (id, tm) values (2, current_timestamp);
Код: Выделить всё
update table1
set tm = current_timestamp
where (id = 1)
в другой
Код: Выделить всё
insert into table2 (fid, tm)
values (1, current_timestamp)
Код: Выделить всё
Unsuccessful execution caused by system error that does not preclude successful execution of subsequent statements.
lock conflict on no wait transaction.
violation of FOREIGN KEY constraint "FK_TABLE2_1" on table "TABLE2".
Foreign key reference target does not exist.
в первой транзакции я поле ID не трогаю, соответственно внешнему ключу нечего беспокоится.
Код: Выделить всё
show version;
ISQL Version: LI-V2.0.1.12855 Firebird 2.0
Server version:
Firebird/linux Intel (access method), version "LI-V2.0.1.12855 Firebird 2.0"
Firebird/linux Intel (remote server), version "LI-V2.0.1.12855 Firebird 2.0/tcp (attid-desktop)/P10"
Firebird/linux Intel (remote interface), version "LI-V2.0.1.12855 Firebird 2.0/tcp (attid-desktop)/P10"
on disk structure version 11.0