mardi 8 mars 2016

sqlite: Cannot select id while rowid works

I have a database schema like this

CREATE TABLE IF NOT EXISTS 
    rephotos (id integer AUTO_INCREMENT, 
              beforePath text, 
              beforeThumbnail blob, 
              afterPath text, 
              afterThumbnail blob, 
              PRIMARY KEY(id)
              );

When trying to SELECT the ids in the database like this

SELECT id FROM rephotos;

it prints nothing. However if I use

SELECT rowid FROM rephotos;

it works as expected. The reason this confuses me is that the sqlite documentation specifically states that

If a table contains a column of type INTEGER PRIMARY KEY, then that column becomes an alias for the ROWID. You can then access the ROWID using any of four different names, the original three names described above or the name given to the INTEGER PRIMARY KEY column. All these names are aliases for one another and work equally well in any context.

What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire