Subject Re: [firebird-support] error attempted update of read-only column creating a trigger
Author Dmitry Yemanov
Didier Gasser-Morlay wrote:
>
> I am puzzled by the following error message. I am porting a database
> from 1.5 to 2.0.1 and when creating the following trigger:
>
> SET TERM ^ ;
> CREATE TRIGGER EMPLOYEE_BI0 FOR EMPLOYEE ACTIVE
> BEFORE INSERT POSITION 0
> AS
> begin
> if (new.username is not null) then
> if (exists (select * from vlogin where vlogin.username =
> new.username)) then
> exception USERNAME_EXISTS;
> end^
> SET TERM ; ^
>
> Engine Code : 335544359
> Engine Message :
> attempted update of read-only column

This means that you're attempting to assign to an improper trigger
context (OLD in any trigger or NEW in after-trigger).

> Note: vlogin is a view on two tables:
> employees and contacts

I'd check their triggers as well, as the error could be caused by the
referenced objects.


Dmitry