diff --git a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php
index ae9137c..cded360 100644
--- a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php
+++ b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php
@@ -1017,7 +1017,7 @@ protected function mapToStorageRecord(ContentEntityInterface $entity, $table_nam
         // SQL database drivers.
         // @see https://www.drupal.org/node/2279395
         $value = drupal_schema_get_field_value($definition->getSchema()['columns'][$column_name], $value);
-        if (!(empty($value) && $this->getSchema()[$table_name]['fields'][$schema_name]['type'] == 'serial')) {
+        if (!(empty($value) && $this->isColumnSerial($table_name, $schema_name))) {
           $record->$schema_name = $value;
         }
       }
@@ -1027,6 +1027,36 @@ protected function mapToStorageRecord(ContentEntityInterface $entity, $table_nam
   }
 
   /**
+   * Checks whether a field column should be treated as serial.
+   *
+   * @param $table_name
+   *   The name of the table the field column belongs to.
+   * @param $schema_name
+   *   The schema name of the field column.
+   *
+   * @return bool
+   *   TRUE if the the column is serial, FALSE otherwise.
+   *
+   * @see \Drupal\Core\Entity\Schema\ContentEntitySchemaHandler::processBaseTable()
+   * @see \Drupal\Core\Entity\Schema\ContentEntitySchemaHandler::processRevisionTable()
+   */
+  protected function isColumnSerial($table_name, $schema_name) {
+    $result = FALSE;
+
+    switch ($table_name) {
+      case $this->baseTable:
+        $result = $schema_name == $this->idKey;
+        break;
+
+      case $this->revisionTable:
+        $result = $schema_name == $this->revisionKey;
+        break;
+    }
+
+    return $result;
+  }
+
+  /**
    * Maps from an entity object to the storage record of the field data.
    *
    * @param \Drupal\Core\Entity\EntityInterface $entity
diff --git a/core/modules/user/src/UserStorage.php b/core/modules/user/src/UserStorage.php
index 3a9d9f5..a00a44d 100644
--- a/core/modules/user/src/UserStorage.php
+++ b/core/modules/user/src/UserStorage.php
@@ -100,6 +100,14 @@ public function save(EntityInterface $entity) {
   /**
    * {@inheritdoc}
    */
+  protected function isColumnSerial($table_name, $schema_name) {
+    // User storage does not use a serial column for the user id.
+    return $table_name == $this->revisionTable && $schema_name == $this->revisionKey;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
   public function saveRoles(UserInterface $account) {
     $query = $this->database->insert('users_roles')->fields(array('uid', 'rid'));
     foreach ($account->getRoles() as $rid) {
