I'm having troubles with an insert trigger that is supposed to fix a column in a table:
id - auto increment int
thread_id - int [NULL]
What I want to achieve is to set the thread_id to id if it's inserted as NULL. I have failed because:
- using
before inserttrigger still does not have the new value foridand mysteriously setsthread_idto 0 - using
after insert - updatetrigger throws reasonable exceptioncan't update table because it is already used by the statement. - you can not add additional auto increment field
What is the solution to this problem?