duckdb / sqlite_scanner

DuckDB extension to read and write to SQLite databases
MIT License
190 stars 19 forks source link

Failure to attach when SQLite tables are created without ROWID #33

Closed sjaenick closed 1 year ago

sjaenick commented 1 year ago

What happens?

A SQLite DB file cannot be attached if it contains tables created without a row id.

To Reproduce

$ sqlite3 sqlite.db
SQLite version 3.40.0 2022-11-12 17:17:01
Enter ".help" for usage hints.
sqlite> create table tablename (id integer primary key) without rowid;
sqlite> insert into tablename values (1);
sqlite> .quit
$ ./build/release/duckdb -unsigned
v0.7.1-dev126 d34bcaf40b
Enter ".help" for usage hints.
D LOAD 'build/release/extension/sqlite_scanner/sqlite_scanner.duckdb_extension';
D CALL sqlite_attach('sqlite.db');
Error: Invalid Error: Failed to prepare query "SELECT MAX(ROWID) FROM "tablename"": no such column: ROWID

OS:

Linux

SQLite Version:

3.40.0

DuckDB Version:

v0.7.1-dev126 d34bcaf40b

DuckDB Client:

CLI

Full Name:

Sebastian Jaenicke

Affiliation:

-

Have you tried this on the latest master branch?

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

Mytherin commented 1 year ago

Thanks for the report - should be fixed by #34