diff --git a/src/database.cpp b/src/database.cpp index 284760a31..571a24bba 100644 --- a/src/database.cpp +++ b/src/database.cpp @@ -51,17 +51,6 @@ void RProgressBarDisplay::Finish() { Update(100); } -static void SetDefaultConfigArguments(ClientContext &context) { - auto progress_display = Rf_GetOption(RStrings::get().progress_display_sym, R_BaseEnv); - if (Rf_isFunction(progress_display)) { - auto &config = ClientConfig::GetConfig(context); - config.enable_progress_bar = true; - } - - // Set the function used to create the display for the progress bar - context.config.display_create_func = RProgressBarDisplay::Create; -} - [[cpp11::register]] duckdb::db_eptr_t rapi_startup(std::string dbdir, bool readonly, cpp11::list configsexp, bool environment_scan) { const char *dbdirchar; @@ -102,6 +91,14 @@ static void SetDefaultConfigArguments(ClientContext &context) { data2->wrapper = wrapper; config.replacement_scans.emplace_back(EnvironmentScanReplacement, std::move(data2)); } + + // Set progress bar configuration on the main database config + auto progress_display = Rf_GetOption(RStrings::get().progress_display_sym, R_BaseEnv); + if (Rf_isFunction(progress_display)) { + config.enable_progress_bar = true; + } + config.display_create_func = RProgressBarDisplay::Create; + wrapper->db = make_uniq(dbdirchar, &config); auto &instance = *wrapper->db->instance; @@ -122,7 +119,7 @@ static void SetDefaultConfigArguments(ClientContext &context) { CreateTableFunctionInfo info(scan_fun); Connection conn(*wrapper->db); auto &context = *conn.context; - SetDefaultConfigArguments(context); + auto &catalog = Catalog::GetSystemCatalog(context); context.transaction.BeginTransaction();