#9422·turso

sqlite/conformance: csv01.test fails all 467 tests because the csv module is never registered

Author: penbergCreated Sep 30, 2026Updated Sep 30, 2026

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 registers ext/misc/csv.c, which is linked into the testfixture binary (src/test1.c, sqlite3_csv_init).
  • In our TCL binding, load_static_extension only knows randomjson. Every other name is accepted and does nothing (TursoLoadStaticExtensionCmd in bindings/tcl/turso_tcl.c).
  • Turso's CSV extension (extensions/csv, crate limbo_csv) is only built as a loadable library. Nothing links it into turso_sqlite3, and bindings/c has no sqlite3_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 (and sqlite3_enable_load_extension) to bindings/c on top of the existing Connection::load_extension in core/ext/dynamic.rs, build limbo_csv in bindings/tcl/Makefile, and load it when the name is csv. This also fills a real gap in the C API.
  • Alternative: link limbo_csv into turso_sqlite3 behind a test-only feature, using the static feature the extension already has (register_extension_static, as cli/app.rs does for limbo_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 header parameter. Tests 1.7 and 5.3 write header with no =value, which upstream treats as header=true. parse_arg requires = and returns InvalidArgs. 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 example d BLOB with WHERE d=12 must return no rows), comparisons such as c1=10 against the default TEXT columns (1.0), and pragma_table_xinfo on 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.test sections 6 and 7 pass (440 tests).
  • Bare header works, with a test that fails before the change. The extension's unit tests in extensions/csv/src/lib.rs are the narrowest place for it.
  • The load_static_extension probe in bindings/tcl/test_probes.tcl still passes for names that do not exist, and gains a check that csv registers the module.
  • sqlite/conformance/upstream/README.md is updated where it says load_static_extension does 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.