Subject | Re: [firebird-support] Generator values corrupt on restore |
---|---|
Author | Gary Benade |
Post date | 2005-01-18T06:52:56Z |
>>Firebird 1.5.2So what you are saying is that 18267668493213428 + 1 = 0?
>>
>>when I do a database restore all my generator values are set to
>>18267668493213428
>>Any idea why?
>
> It's the representation (twos-complement or something like that) of the
> lowest possible negative 64-bit integer. The first time a number is
> generated from it, the generator will "roll over" to zero and generate 1
> (or whatever number the call to Gen_ID dictates).
18267668493213428 in binary is
1000000111001100101100100000011011010011001111011110100 and 40E65903699EF4
in hex. Seems like a random looking number. I admit I have no idea what a
2's compliment is, but I would have expected more 1's and F's in there.
If I have a table that has been freshly restored, and I populate a record
that has a generator for link numbers,
select gen_id( AREA,1) from rdb$database
the first record has a link of 18267668493213428, and the second
18267599912983369, 18267599912983370 ......
How does this translate to 0,1,2 ....?
Apologies if I am missing something blindingly obvious here - I haven't had
enough coffee yet :)