Issue Details (XML | Word | Printable)

Key: CORE-3305
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Dmitry Yemanov
Reporter: Dzirt
Votes: 0
Watchers: 3

If you were logged in you would be able to see more operations.
Firebird Core

"BLOB not found" error after creation/altering of the invalid trigger

Created: 09/Jan/11 06:02 PM   Updated: 25/Sep/15 01:03 PM
Component/s: Engine
Affects Version/s: 2.5.1, 2.1.5, 2.5.2, 2.1.5 Update 1, 2.5.2 Update 1, 3.0 Alpha 1, 3.0 Alpha 2
Fix Version/s: 2.5.3, 3.0 Beta 1

Environment: Firebird
Issue Links:

QA Status: Done successfully

 Description  « Hide
Database in dialect 3, ODS 11.2. In isql execute next command:

C:\>isql localhost:test3 -user SYSDBA -pass masterkey
Database: localhost:test3, User: SYSDBA
SQL> recreate table H( VAL Integer );
SQL> commit;
SQL> set TERM ^ ;
SQL> create or alter trigger H_AI for H
CON> active after insert position 0
CON> as
CON> begin
CON> end^
Statement failed, SQLSTATE = 42000
attempted update of read-only column
SQL> set TERM ; ^
SQL> rollback;
SQL> insert into H( VAL ) values( 123 );
Statement failed, SQLSTATE = HY000
BLOB not found

In this and any other connection established before the execution of the statement 'create or alter trigger ...', can not insert data into a table H.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Helen Borrie added a comment - 10/Jan/11 01:01 AM
The first exception is correct. You can't assign to NEW.anything in an AFTER trigger.
The exception for the second statement seems weird though - seems as though the engine created the BLR for the trigger and then didn't dispose of its pointers properly when the transaction rolled back - hence, DSQL is looking for the code of a non-existent trigger..

Dmitry Yemanov added a comment - 10/Jan/11 11:24 AM
Error "BLOB not found" here means the missing RDB$DEBUG_INFO blob which has been destroyed after a rollback. But even if the debug info would not be a problem, then the "attempted update of read-only column" error would be thrown once more. So the actual problem is that the new trigger gets loaded into the metadata cache before its body is validated, and it's never released from the cache once it's proven to be invalid.

Dmitry Yemanov added a comment - 12/Jun/14 07:12 AM
As both tickets (CORE-3305 and CORE-4390) reference the same issue consisting of two independent bugs, I'm renaming CORE-3305 to describe the "invalid BLOB ID" bug while CORE-4390 will describe the metadata cache bug.