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> set TERM ^ ;
SQL> create or alter trigger H_AI for H
CON> active after insert position 0
CON> NEW.VAL = 1;
Statement failed, SQLSTATE = 42000
attempted update of read-only column
SQL> set TERM ; ^
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.
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..
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.
As both tickets (CORE3305 and CORE4390) reference the same issue consisting of two independent bugs, I'm renaming CORE3305 to describe the "invalid BLOB ID" bug while CORE4390 will describe the metadata cache bug.