From 06492c85328528e3f22248d40d06b64d961164f2 Mon Sep 17 00:00:00 2001 From: Jacob Quinn Date: Mon, 16 Nov 2026 12:39:28 -0700 Subject: [PATCH 1/2] Test that load! matches existing column names ignoring case Co-Authored-By: Claude Opus 5.5 --- test/runtests.jl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index 217a71a..37db245 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -992,6 +992,16 @@ end close(db) end + @testset "load! matches existing column names ignoring case" begin + db = SQLite.DB() + DBInterface.execute(db, "CREATE TABLE people (id INTEGER, name TEXT)") + SQLite.load!((NAME = ["ann"], Id = [1]), db, "people") + @test columntable(DBInterface.execute(db, "SELECT id, name FROM people")) == + (id = [1], name = ["ann"]) + @test_throws SQLiteException SQLite.load!((nam = ["bob"], id = [2]), db, "people") + close(db) + end + @testset "ANALYZE quotes table and index names" begin db = SQLite.DB() @test SQLite.load!((a = [1, 1, 2],), db, "my table"; analyze = true) == "my table" From 05a2698c472cbee67e87a843ec8b1f99ee34eac7 Mon Sep 17 00:00:00 2001 From: Jacob Quinn Date: Mon, 16 Nov 2026 12:43:10 -0700 Subject: [PATCH 2/2] Match load! column names to an existing table ignoring case SQLite compares column names without regard to case, and checkdupnames already does. checknames compared them exactly, so load! rejected a source column NAME for a table column name. Co-Authored-By: Claude Opus 5.5 --- src/tables.jl | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/tables.jl b/src/tables.jl index 5c7e392..9c4781d 100644 --- a/src/tables.jl +++ b/src/tables.jl @@ -350,18 +350,15 @@ function checkdupnames(names::Union{AbstractVector,Tuple}) return true end -# check if schema names match column names in DB +# check if schema names match column names in DB; SQLite compares column names ignoring case function checknames( ::Tables.Schema{names}, db_names::AbstractVector{String}, ) where {names} - table_names = Set(string.(names)) - db_names = Set(db_names) - - if table_names != db_names + if Set(lowercase.(string.(names))) != Set(lowercase.(db_names)) throw( SQLiteException( - "Error loading, column names from table $(collect(table_names)) do not match database names $(collect(db_names))", + "Error loading, column names from table $(collect(string.(names))) do not match database names $(db_names)", ), ) end