Hello Gerry,
Thanks for your answer. Your email is quite clear, but it still doesn't address a key point.
On 28 may 2004, at 23:07, Gerry Snyder wrote:
When you do a "SELECT *", the results contain only columns that are explicitly declared in the CREATE TABLE statement. If you have declared an INTEGER PRIMARY KEY column, then the rowid will appear under that column name. If there is no INTEGER PRIMARY KEY, then the rowid will not be a part of the result
So if you do not have an INTEGER PRIMARY KEY in your table declaration, the rowid will not be part of the saved data and will be lost when the table is reconstructed.
Say I construct a table like this:
CREATE TABLE t1(x INTEGER PRIMARY KEY, y);
and I extract the datatypes like this:
PRAGMA empty_result_callbacks = ON; PRAGMA show_datatypes = ON; SELECT * FROM t1 LIMIT 1;
I get the following datatypes:
x --> INTEGER y --> NULL
If then I manually construct a SQL statement with these datatypes I end up with:
CREATE TABLE t1(x INTEGER, y);
Following the steps in http://www.sqlite.org/faq.html#q13, I have found that:
- Column 'x' will not be an alias of ROWID anymore
- Due to the disassociation between 'x' and ROWID, a statement such as INSERT INTO t1(x,z) VALUES(NULL,321) will no longer increment 'x' the way it was doing before.
I believe this is a bug.
Comments anyone?
Regards,
-- Tito