Re: [sqlite] Help Using RowID

2008-09-06 Thread Darren Duncan
Gerry Snyder wrote: > I am not sure what all this means when taken together. > > It sounds as if defining id as shown above is unnecessary, since it is > just an alias for ROWID, and if one is stable the other has to be. Correct? > > So now I can't interpret "ROWID can change" as meaning anyt

Re: [sqlite] Help Using RowID

2008-09-06 Thread Gerry Snyder
D. Richard Hipp wrote: > On Sep 6, 2008, at 2:50 AM, Scott Hess wrote: > > >> On Fri, Sep 5, 2008 at 11:31 PM, jonwood <[EMAIL PROTECTED]> >> wrote: >> >>> But the documentation states the ROWID >>> can change at any time so I'm not sure what I can do safely. >>> >> Do this: >

Re: [sqlite] Help Using RowID

2008-09-06 Thread Scott Hess
On Sat, Sep 6, 2008 at 7:44 AM, D. Richard Hipp <[EMAIL PROTECTED]> wrote: > On Sep 6, 2008, at 2:50 AM, Scott Hess wrote: >> As a bonus, if the implementation of SQLite changes, SQL itself won't, >> so id will _still_ be a valid integer primary key, even if the >> implementation detail of rowid ch

Re: [sqlite] Help Using RowID

2008-09-06 Thread Derrell Lipman
On Sat, Sep 6, 2008 at 10:44 AM, D. Richard Hipp <[EMAIL PROTECTED]> wrote: > > As a bonus, if the implementation of SQLite changes, SQL itself won't, > > so id will _still_ be a valid integer primary key, even if the > > implementation detail of rowid changes. > > I promise that INTEGER PRIMARY K

Re: [sqlite] Help Using RowID

2008-09-06 Thread D. Richard Hipp
On Sep 6, 2008, at 2:50 AM, Scott Hess wrote: > On Fri, Sep 5, 2008 at 11:31 PM, jonwood <[EMAIL PROTECTED]> > wrote: >> I have a table where the primary key consists of two columns. I'm >> doing this >> because these two columns combined must be unique, while each >> column is not >> uniqu

Re: [sqlite] Help Using RowID

2008-09-06 Thread jonwood
Scott Hess wrote: > > CREATE TABLE t ( > id INTEGER PRIMARY KEY, > a TEXT NOT NULL, > b INTEGER NOT NULL, > UNIQUE (a, b) > ); > > (a,b) will be just as unique as in the first case, but now you can use > id as a stable alias for rowid. There will be the same number of > btrees (one key

Re: [sqlite] Help Using RowID

2008-09-05 Thread Scott Hess
On Fri, Sep 5, 2008 at 11:31 PM, jonwood <[EMAIL PROTECTED]> wrote: > I have a table where the primary key consists of two columns. I'm doing this > because these two columns combined must be unique, while each column is not > unique on its own. > > Because of the increased complexity of a dual-col