Thanks a lot both Igor and Simon for the quick response! Your two answers
settle my doubts.

On Mon, Nov 16, 2015 at 3:48 PM, Simon Slavin <slavins at bigfraud.org> wrote:

> On 16 Nov 2015, at 12:24am, Randy Eels <randyeels at gmail.com> wrote:
>
> > My main question is: is an 'INTEGER PRIMARY KEY' column guaranteed not to
> > change, except as a consequence of ordinary UPDATE statements? (And in
> > particular, not as a consequence of a 'vacuum' statement.)
>
> Values in the rowid column (which has a number of other names) can change
> only if that columns is not aliased by the table definition.  Declaring a
> named column as 'INTEGER PRIMARY KEY' counts as an alias.
>
> > I'd also thank further explanation as to why the 'vacuum' statement
> doesn't
> > change 'rowid's when an explicit 'INTEGER PRIMARY KEY' is declared.
>
> If you declare your own column as being INTEGER PRIMARY KEY, the rowid
> will not change by anything SQLite does automatically.  This is because
> SQLite knows that you know what the column is called, so it thinks you
> might be relying on its values.
>
> The programmer can still change rowid by explicitly updating it, or any
> column aliased to it, using an UPDATE command.
>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>

Reply via email to