I think if it would have been unsigned we could have got more range, as anyways 
negative numbers doesn't make sense as PK's, of course reaching the 2^63-1 is 
remote (or probably impossible)


----- Original Message ----
From: Igor Tandetnik <[EMAIL PROTECTED]>
To: SQLite <sqlite-users@sqlite.org>
Sent: Monday, August 13, 2007 5:31:22 PM
Subject: [sqlite] Re: Auto Increment of Integer Primary Key

<sreedhar.a-324/[EMAIL PROTECTED]> wrote:
> "create table Test(id integer primary key,player char);"
> "insert into Test(id,player) values(2,'surya');"
> "insert into Test(id,player) values(9223372036854775807,'sree');"
> "insert into Test(id,player) values(9223372036854775808,'sree1');"
> "select * from Test;"
> The result is
> -9223372036854775808    sree1
> 2                                    surya
> 9223372036854775807    sree
> I tried inserting 2 power 63 value but the database has converted it
> to -2 power 63 and stored.
> Can anyone explain why this has happened.

SQLite stores ROWIDs as signed 64-bit integers. Such an integer can 
represent 2^64 distinct values, in the range [-2^63, 2^63-1]. 2^63 is 
not representable, it wraps around to -2^63.

Igor Tandetnik 

To unsubscribe, send email to [EMAIL PROTECTED]

Be a better Heartthrob. Get better relationship answers from someone who knows. 
Yahoo! Answers - Check it out. 

Reply via email to