JF0001
JF0001

Reputation: 839

SQLite Syntax Error Flagged in Android Studio on rowid

In Android Studio 3, the rowid column is underlined and flagged as the followig error:

column definition name expected, got 'rowid'

In Android Studio 2.3, I wasn't obtaining this syntax error. Meanwhile, the code still compiles and the app runs properly. Why is this syntax flagged as an error?

"create table myTable " +
                    "(rowid int primary key not null, field2 text, field3 int)"

Upvotes: 0

Views: 101

Answers (1)

CL.
CL.

Reputation: 180020

rowid is the alias name that can always be used, regardless of the actual column name, so it appears that Android Studio treats it as a keyword, although it is not actually one.

This looks like a (harmless) bug in Android Studio.

In any case, many Android framework classes expect the key column to be named _id, so you should probably use that instead of rowid.

Upvotes: 1

Related Questions