duckdb / sqlite_scanner

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

sqlite_table_entry.cpp:56:42: error: cannot convert ‘duckdb::optional_idx’ to ‘duckdb::idx_t&’ {aka ‘long unsigned int&’} #89

Closed ciupicri closed 2 months ago

ciupicri commented 2 months ago

What happens?

[ 59%] Built target sqlite_ext_library
[ 59%] Building CXX object test/api/CMakeFiles/test_api.dir/test_custom_allocator.cpp.o
[ 59%] Building CXX object extension/jemalloc/jemalloc/CMakeFiles/jemalloc.dir/src/prof_log.cpp.o
[ 59%] Building CXX object extension/jemalloc/jemalloc/CMakeFiles/jemalloc.dir/src/prof_recent.cpp.o
/…/sqlite_scanner/src/storage/sqlite_table_entry.cpp: In member function ‘virtual duckdb::TableStorageInfo duckdb::SQLiteTableEntry::GetStorageInfo(duckdb::ClientContext&)’:
/…/sqlite_scanner/src/storage/sqlite_table_entry.cpp:56:42: error: cannot convert ‘duckdb::optional_idx’ to ‘duckdb::idx_t&’ {aka ‘long unsigned int&’}
   56 |         if (!db.GetMaxRowId(name, result.cardinality)) {
      |                                   ~~~~~~~^~~~~~~~~~~
      |                                          |
      |                                          duckdb::optional_idx
In file included from /…/sqlite_scanner/src/include/storage/sqlite_catalog.hpp:13,
                 from /…/sqlite_scanner/src/storage/sqlite_table_entry.cpp:1:
/…/sqlite_scanner/src/include/sqlite_db.hpp:48:59: note:   initializing argument 2 of ‘bool duckdb::SQLiteDB::GetMaxRowId(const std::string&, duckdb::idx_t&)’
   48 |         bool GetMaxRowId(const string &table_name, idx_t &row_id);
      |                                                    ~~~~~~~^~~~~~
[ 60%] Building CXX object tools/shell/linenoise/CMakeFiles/duckdb_linenoise.dir/terminal.cpp.o

To Reproduce

Compile duckdb version ba2b8a318d6b151e24094f9ac848aab37a7fea39 with:

env BUILD_PYTHON=1 BUILD_ODBC=1 BUILD_HTTPFS=1 BUILD_AUTOCOMPLETE=1 BUILD_ICU=1 BUILD_FTS=1 BUILD_JSON=1 GEN=ninja make -j8

Clone sqlite_scanner version 70a4c411434290b4af704940987a324d84af0024, symlink to the previous duckdb repository then compile with:

env BUILD_PYTHON=1 BUILD_ODBC=1 BUILD_HTTPFS=1 BUILD_AUTOCOMPLETE=1 BUILD_ICU=1 BUILD_FTS=1 BUILD_JSON=1 make -j8

I'm using gcc-c++-14.0.1-0.13.fc40.x86_64

OS:

Linux (Fedora 40)

SQLite Version:

3.45.1-2.fc40.x86_64

DuckDB Version:

ba2b8a318d6b151e24094f9ac848aab37a7fea39

DuckDB Client:

ba2b8a318d6b151e24094f9ac848aab37a7fea39

Full Name:

-

Affiliation:

-

Have you tried this on the latest main branch?

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

ciupicri commented 2 months ago

It seems to be fixed in duckdb version 50580b2456 and sqlite_scanner version 091197e

carlopi commented 2 months ago

I think this is solved on v0.10.2 + sqlite_scanner at 091197efb34579c7195afa43dfb5925023c915c0, that is the version declared in https://github.com/duckdb/duckdb/blob/main/.github/config/out_of_tree_extensions.cmake#L92.