Re: [sqlite] vacuum and rowids

2011-04-29 Thread Stephan Beal
On Fri, Apr 29, 2011 at 3:37 AM, Simon Slavin wrote: > The thing is, there's not problem with referring to rowid, or ROWID or any > of the other aliases when you do this. The only problem is possible > confusion for the programmer if you define a column with one of these names > which /isn't/ an

Re: [sqlite] vacuum and rowids

2011-04-29 Thread Nico Williams
On Thu, Apr 28, 2011 at 5:20 PM, Dave Hayden wrote: > On Apr 28, 2011, at 12:41 PM, Pavel Ivanov wrote: >>> After more poking, it appears that rowids might not be changed by a vacuum >>> if I have an index on the table. Is this true? If so, is it something I can >>> rely on going forward? >> >>

Re: [sqlite] vacuum and rowids

2011-04-28 Thread Marco Bambini
Dave please take a look at this blog post: http://www.sqlabs.com/blog/?p=51 -- Marco Bambini http://www.sqlabs.com On Apr 28, 2011, at 9:36 PM, Dave Hayden wrote: > When the VACUUM feature was added I took a look at using it to keep database > file sizes down, but discovered that it changed

Re: [sqlite] vacuum and rowids

2011-04-28 Thread Pavel Ivanov
>> which suggests that referring to rowids is fine. > > It does not suggest referring to ROWIDs is fine, it only says that it > can be done.  I think Pavel's point is that referencing ROWIDs is bad > practice, so that is why he says you shouldn't do it. Yes, that's right. You can refer to rowid, b

Re: [sqlite] vacuum and rowids

2011-04-28 Thread Simon Slavin
On 29 Apr 2011, at 2:31am, Rich Rattanni wrote: >> "You can access the ROWID of an SQLite table using one the special column >> names ROWID, _ROWID_, or OID. Except if you declare an ordinary table column >> to use one of those special names, then the use of that name will refer to >> the decl

Re: [sqlite] vacuum and rowids

2011-04-28 Thread Rich Rattanni
> "You can access the ROWID of an SQLite table using one the special column > names ROWID, _ROWID_, or OID. Except if you declare an ordinary table column > to use one of those special names, then the use of that name will refer to > the declared column not to the internal ROWID." > > which sugg

Re: [sqlite] vacuum and rowids

2011-04-28 Thread Dave Hayden
On Apr 28, 2011, at 12:41 PM, Pavel Ivanov wrote: >> After more poking, it appears that rowids might not be changed by a vacuum >> if I have an index on the table. Is this true? If so, is it something I can >> rely on going forward? > > No, it's not true. The only way to keep your rowids intact

Re: [sqlite] vacuum and rowids

2011-04-28 Thread Pavel Ivanov
> After more poking, it appears that rowids might not be changed by a vacuum if > I have an index on the table. Is this true? If so, is it something I can rely > on going forward? No, it's not true. The only way to keep your rowids intact is to declare an INTEGER PRIMARY KEY alias for it. And yo

[sqlite] vacuum and rowids

2011-04-28 Thread Dave Hayden
When the VACUUM feature was added I took a look at using it to keep database file sizes down, but discovered that it changed rowids and messed up my references between tables (or what I gather the database people call "foreign keys"). I'm playing around with this again and it looks like rowids a