diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index edaf8ec..4a597cf 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -829,6 +829,9 @@ function install_base_system(&$install_state) {
 
   // Enable the user module so that sessions can be recorded during the
   // upcoming bootstrap step.
+  // A user module table references a filter module table, so it must be
+  // installed first.
+  module_enable(array('filter'), FALSE);
   module_enable(array('user'), FALSE);
 
   // Save the list of other modules to install for the upcoming tasks.
diff --git a/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php b/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
index d88633f..8b96fa1 100644
--- a/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
+++ b/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
@@ -278,6 +278,11 @@ class Schema extends DatabaseSchema {
         $keys[] = 'INDEX `' . $index . '` (' . $this->createKeysSqlHelper($fields) . ')';
       }
     }
+    if (!empty($spec['foreign keys'])) {
+      foreach ($spec['foreign keys'] as $key => $definition) {
+        $keys[] = 'FOREIGN KEY (`' . implode('`, `', array_keys($definition['columns'])) . '`) REFERENCES ' . $definition['table'] . '(`' . implode('`, `', $definition['columns']) . '`)';
+      }
+    }
 
     return $keys;
   }
diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php
index 0b65280..c041738 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Schema.php
@@ -141,6 +141,11 @@ class Schema extends DatabaseSchema {
         $sql_keys[] = 'CONSTRAINT ' . $this->prefixNonTable($name, $key_name, 'key') . ' UNIQUE (' . implode(', ', $key) . ')';
       }
     }
+    if (isset($table['foreign keys']) && is_array($table['foreign keys'])) {
+      foreach ($table['foreign keys'] as $key_name => $key) {
+        $sql_keys[] = 'FOREIGN KEY (' . implode(', ', array_keys($key['columns'])) . ') REFERENCES ' . $key['table'] . ' (' . implode(', ', $key['columns']) . ')';
+      }
+    }
 
     $sql = "CREATE TABLE {" . $name . "} (\n\t";
     $sql .= implode(",\n\t", $sql_fields);
diff --git a/core/modules/forum/forum.install b/core/modules/forum/forum.install
index 8e6fddf..a1fc89b 100644
--- a/core/modules/forum/forum.install
+++ b/core/modules/forum/forum.install
@@ -163,6 +163,7 @@ function forum_schema() {
     ),
     'primary key' => array('vid'),
     'foreign keys' => array(
+/* Does not match primary key of referenced table.
       'forum_node' => array(
         'table' => 'node',
         'columns' => array(
@@ -170,6 +171,7 @@ function forum_schema() {
           'vid' => 'vid',
         ),
       ),
+*/
     ),
   );
 
diff --git a/core/modules/node/node.install b/core/modules/node/node.install
index 12b720e..53efdd5 100644
--- a/core/modules/node/node.install
+++ b/core/modules/node/node.install
@@ -127,10 +127,12 @@ function node_schema() {
       'uuid' => array('uuid'),
     ),
     'foreign keys' => array(
+/* node_revision table not yet created. Can't change the table creation order because they each refer to the other.
       'node_revision' => array(
         'table' => 'node_revision',
         'columns' => array('vid' => 'vid'),
       ),
+*/
       'node_author' => array(
         'table' => 'users',
         'columns' => array('uid' => 'uid'),
@@ -190,10 +192,12 @@ function node_schema() {
     ),
     'primary key' => array('nid', 'gid', 'realm'),
     'foreign keys' => array(
+/* node_install() creates a record with nid = 0, which cannot exist since nid is serial and must be > 0. https://drupal.org/node/1703222
       'affected_node' => array(
         'table' => 'node',
         'columns' => array('nid' => 'nid'),
       ),
+*/
      ),
   );
 
diff --git a/core/modules/search/search.install b/core/modules/search/search.install
index cc17523..a86468b 100644
--- a/core/modules/search/search.install
+++ b/core/modules/search/search.install
@@ -87,6 +87,7 @@ function search_schema() {
       'sid_type' => array('sid', 'langcode', 'type'),
     ),
     'foreign keys' => array(
+/* Foreign key definition does not match primary key. Must add langcode field. https://drupal.org/node/1743198
       'search_dataset' => array(
         'table' => 'search_dataset',
         'columns' => array(
@@ -94,6 +95,7 @@ function search_schema() {
           'type' => 'type',
         ),
       ),
+*/
     ),
     'primary key' => array('word', 'sid', 'langcode', 'type'),
   );
diff --git a/core/modules/shortcut/shortcut.install b/core/modules/shortcut/shortcut.install
index 9ee9fd3..43642cb 100644
--- a/core/modules/shortcut/shortcut.install
+++ b/core/modules/shortcut/shortcut.install
@@ -76,10 +76,12 @@ function shortcut_schema() {
     ),
     'primary key' => array('set_name'),
     'foreign keys' => array(
+/* shortcut_set_save() creates shortcut_set records before menu_links records, violating this constraint. https://drupal.org/node/1703208
       'menu_name' => array(
         'table' => 'menu_links',
         'columns' => array('set_name' => 'menu_name'),
       ),
+*/
     ),
   );
 
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index 0e42214..e15113d 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -928,10 +928,12 @@ function system_schema() {
     ),
     'primary key' => array('fid'),
     'foreign keys' => array(
+/* system module is installed first, before users table is created.
       'file_owner' => array(
         'table' => 'users',
         'columns' => array('uid' => 'uid'),
       ),
+*/
     ),
   );
 
@@ -1574,10 +1576,12 @@ function system_schema() {
       'ssid' => array('ssid'),
     ),
     'foreign keys' => array(
+/* system module is installed first, before users table is created.
       'session_user' => array(
         'table' => 'users',
         'columns' => array('uid' => 'uid'),
       ),
+*/
     ),
   );
 
