diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php
index fba74da..43625b1 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Insert.php
@@ -120,11 +120,11 @@ public function __toString() {
     // If we're selecting from a SelectQuery, finish building the query and
     // pass it back, as any remaining options are irrelevant.
     if (!empty($this->fromQuery)) {
-      $insert_fields_string = $insert_fields ? ' (' . implode(', ', $insert_fields) . ') ' : ' ';
+      $insert_fields_string = $insert_fields ? ' (' . implode(', ', array_map('Drupal\Core\Database\Driver\pgsql\Insert::escape', $insert_fields)) . ') ' : ' ';
       return $comments . 'INSERT INTO {' . $this->table . '}' . $insert_fields_string . $this->fromQuery;
     }
 
-    $query = $comments . 'INSERT INTO {' . $this->table . '} (' . implode(', ', $insert_fields) . ') VALUES ';
+    $query = $comments . 'INSERT INTO {' . $this->table . '} (' . implode(', ', array_map('Drupal\Core\Database\Driver\pgsql\Insert::escape', $insert_fields)) . ') VALUES ';
 
     $max_placeholder = 0;
     $values = array();
@@ -154,4 +154,10 @@ public function __toString() {
 
     return $query;
   }
+
+  // Surrounds a column name with double quotes in case it is a reserved word.
+  private static function escape($column) {
+    return '"' . $column . '"';
+  }
+
 }
