sequence problem of IDS 11.5
Posted in 2012
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Transactions, Locking & Isolation, Platform-Specific Issues
I've a centOS Linux running 11.50.UC7IE , everyday I run the sql first :
alter sequence seq_dealsession restart with 1;
and then run a esql/c ap , I use :
EXEC SQL select seq_dealsession.nextval into $seqval
from systables where tabid = 1 ;
EXEC SQL insert into xxxx(seqno,...) values($seqval,....) ;
or
EXEC SQL insert into xxxx(seqno,...) values(seq_dealsession.nextval ,...) ;
It runs very fine , until I run
dbschema -d db1 db1.sql -ss in another shell ,each time I run this dbschema command , the seq_dealsession.nextval
always skip one number , for example , if xxx.seqno is 1000 now ,
while I run dbschema -d in another shell , select * from xxx where seqno > 1000
will get 1002 ,1003,..., but 1001 is missed !!
I tested this in about insert table xxx 30 rows per second ...
No matter dirty read or not , or set lock mode to wait 2 ....
I figure out that sequence's nextval really jump one number while
another shell run "dbschema -d db1 db1.sql -ss" ,
What can I do for this case ?
Any suggestions are appreciated !! Thnks ..
On Fri, Mar 9, 2012 at 01:09, MARS CHEN <hedgezzz@yahoo.com.tw> wrote:
> I've a centOS Linux running 11.50.UC7IE , everyday I run the sql first :
> alter sequence seq_dealsession restart with 1;
> and then run a esql/c ap , I use :
>
> EXEC SQL select seq_dealsession.nextval into $seqval
> from systables where tabid = 1 ;
> EXEC SQL insert into xxxx(seqno,...) values($seqval,....) ;
>
> or
>
> EXEC SQL insert into xxxx(seqno,...) values(seq_dealsession.nextval ,...) ;
>
> It runs very fine , until I run
> dbschema -d db1 db1.sql -ss in another shell ,> each time I run this dbschema command , the seq_dealsession.nextval
> always skip one number , for example , if xxx.seqno is 1000 now ,
> while I run dbschema -d in another shell , select * from xxx where seqno >
> 1000
> will get 1002 ,1003,..., but 1001 is missed !!
> I tested this in about insert table xxx 30 rows per second ...
>
> No matter dirty read or not , or set lock mode to wait 2 ....
> I figure out that sequence's nextval really jump one number while
> another shell run "dbschema -d db1 db1.sql -ss" ,
> What can I do for this case ?
>
Don't run DB-Schema.
Do report the bug so it can be fixed. Your observation confirms what I
have observed (but not investigated) while making a separate bug fix in
DB-Schema, but I haven't formally converted it into a separate bug.
--
Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h>
Guardian of DBD::Informix - v2011.0612 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."
--e0cb4efa6ed84b4b7604bad10b4b