diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php b/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
index ad2ac19..31ab835 100644
--- a/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
+++ b/core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php
@@ -189,11 +189,9 @@ protected function checkBinaryOutputSuccess() {
   }
 
   /**
-   * Ensures standard_conforming_strings setting is 'on'.
+   * Ensures standard_conforming_strings setting is 'off'.
    *
-   * When standard_conforming_strings setting is 'on' string literals ('...')
-   * treat backslashes literally, as specified in the SQL standard. This allows
-   * Drupal to convert between bytea, text and varchar columns.
+   * This makes Postgres behave the same as MySQL.
    */
   public function checkStandardConformingStrings() {
     $database_connection = Database::getConnection();
@@ -205,7 +203,7 @@ public function checkStandardConformingStrings() {
       // code is only called when a connection to the database is already
       // established, thus the database name is guaranteed to be a correct
       // value.
-      $query = "ALTER DATABASE \"" . $connection_options['database'] . "\" SET standard_conforming_strings = 'on';";
+      $query = "ALTER DATABASE \"" . $connection_options['database'] . "\" SET standard_conforming_strings = 'off';";
       try {
         $database_connection->query($query);
       }
@@ -223,8 +221,8 @@ public function checkStandardConformingStrings() {
       if (!$this->checkStandardConformingStringsSuccess()) {
         $replacements = array(
           '%setting' => 'standard_conforming_strings',
-          '%current_value' => 'off',
-          '%needed_value' => 'on',
+          '%current_value' => 'on',
+          '%needed_value' => 'off',
           '!query' => "<code>" . $query . "</code>",
         );
         $this->fail(t("The %setting setting is currently set to '%current_value', but needs to be '%needed_value'. Change this by running the following query: !query", $replacements));
@@ -237,7 +235,7 @@ public function checkStandardConformingStrings() {
    */
   protected function checkStandardConformingStringsSuccess() {
     $standard_conforming_strings = Database::getConnection()->query("SHOW standard_conforming_strings")->fetchField();
-    return ($standard_conforming_strings == 'on');
+    return ($standard_conforming_strings == 'off');
   }
 
   /**
diff --git a/core/modules/system/src/Tests/Database/SchemaTest.php b/core/modules/system/src/Tests/Database/SchemaTest.php
index e6aea74..e3f0db0 100644
--- a/core/modules/system/src/Tests/Database/SchemaTest.php
+++ b/core/modules/system/src/Tests/Database/SchemaTest.php
@@ -714,6 +714,15 @@ protected function assertFieldChange($old_spec, $new_spec, $test_data = NULL) {
       $id = db_insert($table_name)
         ->fields(['test_field'], [$test_data])
         ->execute();
+      // Ensure inserting does not change the value.
+      $field_value = db_select($table_name)
+        ->fields($table_name, ['test_field'])
+        ->condition('serial_column', $id)
+        // Ensure that the storage is not messing with the length of the string.
+        ->where('LENGTH(test_field) = :length', [':length' => strlen($test_data)])
+        ->execute()
+        ->fetchField();
+      $this->assertIdentical($field_value, $test_data);
     }
 
     // Change the field.
@@ -723,6 +732,8 @@ protected function assertFieldChange($old_spec, $new_spec, $test_data = NULL) {
       $field_value = db_select($table_name)
         ->fields($table_name, ['test_field'])
         ->condition('serial_column', $id)
+        // Ensure that the storage is not messing with the length of the string.
+        ->where('LENGTH(test_field) = :length', [':length' => strlen($test_data)])
         ->execute()
         ->fetchField();
       $this->assertIdentical($field_value, $test_data);
