ID some fields ID_AUTOINSERT
123 xxx null
234 xxx null
255 xxx 266
266 xxx null
Now there is a trigger after delete in this table who deletes:
if(old.ap = 69) then
delete from tplan_kw_pos where id_autoinsert = http://old.id;
In this case, FB will delete the record with ID 266 during deleting ID 255 and the other statement intends to delete the record 266 too.
Now in FB 3 RC 2 I get this error message:
can't format message 13:492 -- message file C:\WINDOWS\SYSTEM32\firebird.msg not found.
no current record for fetch operation.
In FB 2.55, FB2.1 this was not a problem.
the trigger is required because the user can delete the one record only, in
this case the trigger deletes the referenced one with the id_autoinsert-id too. But if I delete the
entire Order, the record will be delete twice. How can I solve this in fb 3?
Does error happen with just one connection or two independent connections? Does the second statement delete the record after the first one or concurrently? Which statement does produce the error - first or second? Any chance for a reproducible test case?
I get the error with one connection, the other clients does not call this stored procedure. This SP should delete all records incluedes a certain order, I think, during deleting the one record, the trigger deletes in the same table this with the referenced ID and the SP found not the marked record again and I get an error during SP-Call like this in my post.
By debugging, the statement in SP "delete from table where .. "
Herewith a sql file for creating test-table, insert records and execute for error.
summary: delete trigger during deleting (twice deleting and error no current record for fetch operation. => Error "no current record to fetch" if some record is to be deleted both by the statement itself and by some trigger fired during statement execution
I have same problem with FB3.0 (no problems with FB2 or FB1.5).
It also involves delete trigger that deletes from same table. And in result it is not possible to delete multiple records from this table in one transaction. It seems that if record is already deleted by trigger then it is still visible in same transaction context and when second delete occurs then this error is thrown:
ISC ERROR CODE:335544348 ISC ERROR MESSAGE: no current record for fetch operation
CREATE TABLE TEST_TABLE (
ID NUMERIC(10,0) NOT NULL,
ALTER TABLE TEST_TABLE ADD PRIMARY KEY (ID);
SET TERM ^ ;
CREATE TRIGGER TEST_TABLE_D FOR TEST_TABLE
ACTIVE BEFORE DELETE POSITION 0
delete from TEST_TABLE where related_id=http://old.ID;
SET TERM ; ^
INSERT INTO TEST_TABLE (ID,RELATED_ID) VALUES (1,NULL);
INSERT INTO TEST_TABLE (ID,RELATED_ID) VALUES (2,1);
/* AND THIS WILL GIVE ERROR: */
DELETE FROM TEST_TABLE;