|Subject||Re: [firebird-support] Deadlock exception occurs but it shouldn't?|
You should 'lock' the record you are working with.
Did you read about 'with lock'?
I am not sure this will help you in this case, but....
I have a very simple table:
CREATE TABLE PARAMS
ID INTEGER NOT NULL,
NAME VARCHAR(32) NOT NULL,
CONSTRAINT PK_PARAMS PRIMARY KEY (ID),
CONSTRAINT UNQ_PARAMS UNIQUE (NAME)
I have two threads which constantly and at the same time are writing to this table:
UPDATE OR INSERT INTO PARAMS (NAME) VALUES(:P_NAME) MATCHING (NAME) RETURNING ID;
I've set my transaction parameters like this:
As far as I understand, such configuration should prevent deadlock exception to occur. However, deadlock still occurs from time to time:
Update conflicts with concurrent update.
Concurrent transaction number is 57258.
What am I doing wrong?
Thans for your assistance :)
-- Atenciosamente, Hugo Eyng