sqlite/conformance: csv01.test fails all 467 tests because the csv module is never registered
Problem
sqlite/conformance/upstream/csv01.test fails all 467 of its tests in the upstream SQLite TCL conformance run (see the 2026-09-30 report, main at 33c1036a3).
The cause is in the test harness, not in the engine. Turso has a CSV extension, but the harness never registers it:
- The test starts with
load_static_extension db csv. In upstream SQLite this command registersext/misc/csv.c, which is linked into thetestfixturebinary (src/test1.c,sqlite3_csv_init). - In our TCL binding,
load_static_extensiononly knowsrandomjson. Every other name is accepted and does nothing (TursoLoadStaticExtensionCmdinbindings/tcl/turso_tcl.c). - Turso's CSV extension (
extensions/csv, cratelimbo_csv) is only built as a loadable library. Nothing links it intoturso_sqlite3, andbindings/chas nosqlite3_load_extension.
So every CREATE VIRTUAL TABLE ... USING csv(...) in the file fails because the module does not exist, and every later test fails with it.
This analysis comes from reading the harness and the extension code. The test was not re-run to confirm each point below.
Proposed fix
1. Register the csv module in the harness
Make load_static_extension db csv register limbo_csv on that connection. Two ways to do it:
- Preferred: add
sqlite3_load_extension(andsqlite3_enable_load_extension) tobindings/con top of the existingConnection::load_extensionincore/ext/dynamic.rs, buildlimbo_csvinbindings/tcl/Makefile, and load it when the name iscsv. This also fills a real gap in the C API. - Alternative: link
limbo_csvintoturso_sqlite3behind a test-only feature, using thestaticfeature the extension already has (register_extension_static, ascli/app.rsdoes forlimbo_completion). Less code, but it adds a test-only feature to the C library.
Note that the test calls reset_db followed by load_static_extension db csv inside its loops, so registration must work per connection and repeatedly.
This step alone should fix most of the file. 440 of the 467 tests are the two loops at the end (sections 6 and 7), which only use filename='csv.data', header=true.
2. Fix the CSV extension gaps in the other 27 tests
From reading extensions/csv/src/lib.rs:
- Bare
headerparameter. Tests 1.7 and 5.3 writeheaderwith no=value, which upstream treats asheader=true.parse_argrequires=and returnsInvalidArgs. This is a real compatibility bug. - Error messages. Test 4.3 expects
cannot open 'FileDoesNotExist.csv' for reading. The extension only returns result codes, so the message most likely differs. - Not checked yet: column affinity taken from
schema=(tests 2.x, for exampled BLOBwithWHERE d=12must return no rows), comparisons such asc1=10against the defaultTEXTcolumns (1.0), andpragma_table_xinfoon a virtual table (1.4, 1.6, 1.8).
Out of scope
Tests 3.x and 4.0 to 4.2 use testflags=1 and the csv_wr module. Upstream compiles both only under SQLITE_TEST. Do not add test-only code to the extension for these. csv01 stays on the known-bad list in all.test because of them.
Acceptance
csv01.testsections 6 and 7 pass (440 tests).- Bare
headerworks, with a test that fails before the change. The extension's unit tests inextensions/csv/src/lib.rsare the narrowest place for it. - The
load_static_extensionprobe inbindings/tcl/test_probes.tclstill passes for names that do not exist, and gains a check thatcsvregisters the module. sqlite/conformance/upstream/README.mdis updated where it saysload_static_extensiondoes nothing.- Do not modify
sqlite/conformance/upstream/csv01.test.
Background
The CSV virtual table comes from SQLite's own source tree (ext/misc/csv.c, documented at https://www.sqlite.org/csv.html). It is not part of the amalgamation and not part of sqlean. extensions/csv is a port of it.
Source: tursodatabase/turso