Subject Re: [firebird-support] "Attempted update of read-only column"
Author Helen Borrie
At 10:51 PM 24/02/2010, PenWin wrote:
>I am trying what would happen if I run my Firebird 1.5 application
>against a Firebird 2.1 server. I managed to get both servers running (FB
>1.5 on port 3050, FB 2.1 on port 3052), backed up the database using 1.5
>GBAK, restored the database using 2.1 GBAK and started my application.
>Now I am getting an "Attempted update of read-only column". Reading the
>documentation, it is obvious that in some trigger there is probably a
>write to OLD field.

A write to an OLD field was not valid syntax in v.1.5, either. So that is much less likely than an AFTER trigger that is trying to assign to a NEW field. In v.1.5, you could *write* a trigger like that but the Fb 1.5 engine would just ignore it. From Fb 2 onward, it causes an outright exception.

>Unfortunately, I can't find the location of this
>write, mainly because there are great many triggers and procedures that
>get called.

To find the offending triggers you need to do a full metadata extract to a file, and search all of your trigger code for an AFTER trigger that is doing NEW.SOMETHING = SOMETHING. Then, you need to get everyone offline and do ALTER TRIGGER for each one that has the problem. You could do that with a script.

>Is there some way of getting a more detailed error
>information, such as the name of the trigger that actually caused it?