Skip to content

Commit 7e21cbe

Browse files
authored
Fix MotherDuck table sync (#431)
1 parent 9928538 commit 7e21cbe

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/pgduckdb_background_worker.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,14 @@ SyncMotherDuckCatalogsWithPg_Cpp(bool drop_with_cascade) {
554554

555555
initial_cache_version = pgduckdb::CacheVersion();
556556

557-
auto connection = pgduckdb::DuckDBManager::GetConnection();
557+
/*
558+
* We don't use GetConnection, because we want to be able to precisely
559+
* control the transaction lifecycle. We commit Postgres connections
560+
* throughout this function, and the GetConnect its cached connection its
561+
* lifecycle would be linked to those postgres transactions, which we
562+
* don't want.
563+
*/
564+
auto connection = pgduckdb::DuckDBManager::Get().CreateConnection();
558565
auto &context = *connection->context;
559566

560567
auto &db_manager = duckdb::DatabaseManager::Get(context);

0 commit comments

Comments
 (0)