Re: [sqlite] problem with auto increment of ROWID

2006-08-30 Thread Bruce Q. Hammond
To save someone the trouble, it's about 2924 centuries. :-) --BQ [EMAIL PROTECTED] wrote: Dixon Hutchinson <[EMAIL PROTECTED]> wrote: If I actually specify AUTOINCREMENT, then an insert will fail when I have reached the max row value, even if there are unused rows in the table. So I don

Re: [sqlite] problem with auto increment of ROWID

2006-08-30 Thread Martin Jenkins
Dixon Hutchinson wrote: But I need ROWID to auto increment until the largest 64-bit integer value is used You'll never get there - 2^64 is huge. 2^31 seconds is about 68 years so even if you're getting billions of inserts/sec you'll be dead before the rowid wraps. Martin ---

Re: [sqlite] problem with auto increment of ROWID

2006-08-30 Thread davep
> 9,223,372,036,854,775,807 / (1,000,000 * 60seconds * 60minutes * 24hours * > 365days) = 292471 years > > On 8/30/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >> The maximum rowid is 9223372036854775807. You're going to take >> a long time to reach that value if you start with 1. >> >> Do

Re: [sqlite] problem with auto increment of ROWID

2006-08-30 Thread Clay Dowling
It's great to design your application to be future proof and all, but I think Dr. Hipp has a point: that failure point probably isn't in your lifetime, or the lifetime of 32 bit computing. Do you have a particular reason for needing this behavior, other than your own desires? If choosing non-sequ

Re: [sqlite] problem with auto increment of ROWID

2006-08-30 Thread Dixon Hutchinson
I did the math once, came to the same conclusion, then somewhere in the last moths, forgot it and slipped into 32-bit mode for some reason :-[ Specifying AUTOINCREMENT should work fine for what I need. [EMAIL PROTECTED] wrote: Dixon Hutchinson <[EMAIL PROTECTED]> wrote: If I actually speci

Re: [sqlite] problem with auto increment of ROWID

2006-08-30 Thread Joel Lucsy
9,223,372,036,854,775,807 / (1,000,000 * 60seconds * 60minutes * 24hours * 365days) = 292471 years On 8/30/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: The maximum rowid is 9223372036854775807. You're going to take a long time to reach that value if you start with 1. Do the math: If you

Re: [sqlite] problem with auto increment of ROWID

2006-08-30 Thread Dixon Hutchinson
Brandon, I think you tickled the right neurons. I misread the SQLite web page. Below is the statement from the web page. The italics is how I mis-interpreted it. If no ROWID is specified on the insert, an appropriate ROWID is created automatically. The usual algorithm is to give the n

Re: [sqlite] problem with auto increment of ROWID

2006-08-30 Thread Mario Frasca
Dixon Hutchinson wrote: I have not reach a point of creating a "maximum possible ROWID", I'm only at three rows. it's a matter of definition... if you just reached three rows, without deletions, then the maximum rowid is 3. If I actually specify AUTOINCREMENT, then an insert will fail w

Re: [sqlite] problem with auto increment of ROWID

2006-08-30 Thread Dixon Hutchinson
But "AUTOINCREMENT" has slightly different behavior that what I desire. The difference is what happens when the ROWID reaches the "largest possible integer". If AUTOINCREMENT is specified, then the next insert after "largest possible integer" is reach will fail, regardless of the availability

Re: [sqlite] problem with auto increment of ROWID

2006-08-30 Thread drh
Dixon Hutchinson <[EMAIL PROTECTED]> wrote: > > If I actually specify AUTOINCREMENT, then an insert will fail when I > have reached the max row value, even if there are unused rows in the > table. So I don't want to specify AUTOINCREMENT. > The maximum rowid is 9223372036854775807. You're go

RE: [sqlite] problem with auto increment of ROWID

2006-08-30 Thread Brandon, Nicholas \(UK\)
>I have not reach a point of creating a "maximum possible ROWID", I'm only at three rows. The behavior I was desiring is: > >If no ROWID is specified on the insert, an appropriate ROWID is >created automatically. The usual algorithm is to give the newly >created row a ROWID that is

Re: [sqlite] problem with auto increment of ROWID

2006-08-30 Thread Mario Frasca
Dixon Hutchinson wrote: H:\b>sqlite3.exe t.dat SQLite version 3.3.7 Enter ".help" for instructions sqlite> CREATE TABLE abc ...> ( ...> c TEXT, ...> p INTEGER, ...> t TEXT, ...> masked INTEGER PRIMARY KEY, ...>

Re: [sqlite] problem with auto increment of ROWID

2006-08-30 Thread Dixon Hutchinson
I have not reach a point of creating a "maximum possible ROWID", I'm only at three rows. The behavior I was desiring is: If no ROWID is specified on the insert, an appropriate ROWID is created automatically. The usual algorithm is to give the newly created row a ROWID that is one larg

Re: [sqlite] problem with auto increment of ROWID

2006-08-30 Thread Dixon Hutchinson
I thought actually specifying a ROWID would be harmless. So I tried your idea, same results: H:\b>sqlite3.exe t.dat SQLite version 3.3.7 Enter ".help" for instructions sqlite> CREATE TABLE abc ...> ( ...> c TEXT, ...> p INTEGER, ...>

Re: [sqlite] problem with auto increment of ROWID

2006-08-30 Thread Mario Frasca
Dixon Hutchinson wrote: [...] I was hoping to get the behavior specified at http://www.sqlite.org/autoinc.html. where the AUTOINCREMENT keyword is not used. but you are getting quite exactly what is stated there: «If you ever delete rows or if you ever create a row with the maximum possibl

Re: [sqlite] problem with auto increment of ROWID

2006-08-30 Thread Clay Dowling
ROWID is a reserved word. Each row has one and you don't need to specify it. In fact you probably shouldn't, since it seems to be causing you problems. If you want the column to be explicitly declared in your table, call it something else like id. If you don't want to do that just use the keywo

[sqlite] problem with auto increment of ROWID

2006-08-30 Thread Dixon Hutchinson
I am having a problem with default behavior of ROWID not auto-incrementing. I use the following to create my table: CREATE TABLE abc { c TEXT, p INTEGER, t TEXT, ROWID INTEGER PRIMARY KEY, UNIQUE(p,c) ); When I insert into the table using just c, p and t, I see that ROWID is assi