0

I am using SQLLite.Net-PCL 3.1.1 in one of my projects and I ran in to the "SQLite.SQLiteException: duplicate column name" issue when creating the table in SQLite.

The reason was because my parent class (which I don't own) has a column named "ID". My interface has a column named "Id", note the casing.

I solved this issue by adding the following line of code to my derived class:

[Ignore]
public new long ID { get; set; }

Where the [Ignore] attribute prevents the "ID" column from being added to my SQLite db which solves my issue.

My question is: are column names in SQLite not case sensitive by design or is this a bug?

Niels
  • 1,366
  • 15
  • 21
  • I think column named are case insensitive, but even if they were case sensitive using the same name would be inviting trouble later on IMO. – Tim Biegeleisen Nov 11 '17 at 12:37
  • 1
    They're case-insensitive unless you're referencing them in quotations. So `select id from table` and `select "ID" from table` are not the same. Probably relevant here. https://stackoverflow.com/a/19933159/2193107 – JBC Nov 11 '17 at 12:41
  • This is how the SQL language is defined. –  Nov 11 '17 at 13:09

1 Answers1

1

In SQLite, all SQL identifers are case-insensitive (even when quoted).

CL.
  • 173,858
  • 17
  • 217
  • 259