Suppose I have a simple table with an integer primary key:

CREATE TABLE table (
    id INTEGER PRIMARY KEY NOT NULL,
    name TEXT
);

and insert values without supplying a value for the primary key:

INSERT INTO table (name) VALUES (@name);

Is it guaranteed that the primary key is always positive? In my
application code, I would like to reserve negative values (and possibly
zero) for special meanings, but that is only possible if they never
appear in the database.

In the documentation [1], I read the primary key is a signed integer, so
it can hold negative numbers. But the autoincrement algorithm starts
counting from 1 and thus the primary key should never become negative or
zero. Or is that not true?

[1] http://www.sqlite.org/autoinc.html



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to