diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Upsert.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Upsert.php
index a0a9de8..b425b5b 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Upsert.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Upsert.php
@@ -91,6 +91,9 @@ public function execute() {
       $this->connection->insert($this->table, $this->queryOptions)
         ->from($select)
         ->execute();
+
+      // Commit the transaction explicitly.
+      $this->connection->popTransaction($transaction->name());
     }
     catch (\Exception $e) {
       // One of the queries failed, rollback the whole batch.
