Hi people, it’s a long time I did not get there.

I’m currently to create and use an SQLite DB with the Python biding APSW. For 
each row returned, I always retrieve the description with 
`Cursor.getdescription()`. Surprisingly, during a test, I noticed the name of a 
column as returned in the description, is not the same as in the query. That 
column, is an alias of the ROWID.

Here is an example to test:

    -- `id` is `integer primary key`, so that it is an alias of rowid,
    -- which is necessary to use it in `using (…)` clauses.

    create table test (id integer primary key, a int, b int);

    insert into test (a, b) values (1, 2);
    insert into test (a, b) values (3, 4);
    insert into test (a, b) values (5, 6);
    insert into test (a, b) values (7, 8);

    select rowid, id, a, b from test;

The description of the SELECT query result, returns these column names: ID, ID, 
A, B, instead of ROWID, ID, A, B.

That’s not annoying to me, since this was just to check ID is indeed an alias 
of ROWID (it’s a long time I did not use SQLite), but may be that’s a bug, 
although not a nasty one, so I wanted to tell. Unless I’m wrong and that’s the 
expected result?

Aside, what also surprised me just a moment ago and I never noticed before, is 
that although I can refer to ROWID (not aliased) anywhere in a query, it seems 
to not work properly in `using(rowid)`, if the ROWID is automatically generated 
in one of the table (ex. an ordinary table with no “without rowid”) and it is 
not in the other table (ex. a column named ROWID in a VIEW).
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to