Hi.
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....
Hugo
On 24/12/2014 06:22, [email protected] [firebird-support] wrote:
Hi,
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:
FtraMain.TRParams.Add('isc_tpb_write');
FtraMain.TRParams.Add('isc_tpb_read_committed');
FtraMain.TRParams.Add('isc_tpb_wait');
FtraMain.TRParams.Add('isc_tpb_no_rec_version');
As far as I understand, such configuration should prevent deadlock
exception to occur. However, deadlock still occurs from time to time:
Deadlock.
Deadlock.
Update conflicts with concurrent update.
Concurrent transaction number is 57258.
What am I doing wrong?
Thans for your assistance :)
--
Atenciosamente,
Hugo Eyng