Indexing problem with On-Line
Posted in 1991
{
Hi there. I have an amazing problem with Informix On-Line version 4.00.UE2.
When two programs try to insert a row in the same table (within a
transaction ) and the one that has the greater value in a column with a
unique index, inserts his row first, then the other one aborts. If the
opposite arises everithing works fine.
Let us see an axample in detail that you can try using two isql running
at the same time.
}
#if P == 1 /* P1 */
create table xx ( a integer ) lock mode row;
create unique index ii on xx( a );
#elif P == 2 /* P2 */
set isolation to dirty read; { Even this way it won't work!!... }
begin work;
insert into xx values ( 1 );
#elif P == 3 /* P3 */
set isolation to dirty read; { Even this way it won't work!!... }
begin work;
insert into xx values ( 2 );
#endif
{
Using P1 to create the required table, when you start processes P2 and
P3 either one of two things happens: if P2 manages to insert its row first
then everything works fine, if on the other hand, P3 inserts its row first
then P2 stops with the folowing error message:
271: Could not insert new row into the table.
144: ISAM error: key value locked
Error in line 1
Near character position 28
PS: For better control of the flow try running the instructions in P2 and P3
one at a time.
}
ats :)
--------------------------------------------------------------------------------
| Abilio Tavares da Silva |
| S.S.F. - Servicos de Software Financeiro, Lda VOICE: +351 (1) 727-0303 |
| Estrada da Luz 104, Loja A FAX: +351 (1) 727-0335 |
| 1600 Lisboa E-MAIL: ats@ssf.pt |
| PORTUGAL |
--------------------------------------------------------------------------------