Skip to content

Case sensitivity of column and table names is inconsistent with SQLite #9

@wandernauta

Description

@wandernauta

The SQLiteWriter::addValue method treats identifiers case-sensitively in its schema handling, which differs from SQLite, where they are treated case-insensitively (ref. sqlite3_stricmp).

This leads to errors if SQLiteWriter thinks tables foo and Foo are different tables, but SQLite does not:

sqw.addValue({{"a", 0}}, "foo");
sqw.addValue({{"c", 0}}, "Foo");
sqw.addValue({{"c", 0}}, "foo");
// exception: Error executing sqlite3 query 'ALTER table "foo" add column "c" INT ': duplicate column name: c

Similarly for column names:

sqw.addValue({{"a", 0}}, "bar");
sqw.addValue({{"A", 0}}, "bar");
// exception: Error executing sqlite3 query 'ALTER table "bar" add column "A" INT ': duplicate column name: A

I would expect these identifiers to have their case stored but then be compared case-insensitively, which seems most consistent with how it is currently used; for example, tkconv.cc uses table names link and Zaal; tkserv.cc uses table names Document and document interchangeably. Alternatively, SQLiteWriter could enforce or check that identifiers are, say, always lowercase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions