On 13 Nov 2009, at 2:07pm, Marco Bambini wrote: > CREATE TABLE foo (col1 INTEGER PRIMARY KEY, col2 TEXT); > a > SELECT rowid, col1, col2 > > returns the following column names with sqlite3_column_name: > col1, col1, col2 > > Is there a way to force the first column name to be returned as rowid and not > as its col1 alias?
Define rowid explicitly as a column of the TABLE. The documentation explicitly states that column names are valid only for those columns returned which are copies of columns in a table. SQLite can return anything it likes as names of calculation and derived columns, and what it returns may change between different versions of SQLite. It's better not to rely on 'rowid' in your code unless you have defined it as a column yourself. First because this is purely a SQLite thing and will confuse users of other SQLs. Second because 'rowid' is just one of the many different names you can use for that idea. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users