diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/SettingsTest.php b/core/modules/views/lib/Drupal/views/Tests/UI/SettingsTest.php
index faa92e1..7c92361 100644
--- a/core/modules/views/lib/Drupal/views/Tests/UI/SettingsTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/UI/SettingsTest.php
@@ -91,6 +91,29 @@ function testEditUI() {
     views_invalidate_cache();
     $this->drupalPost('admin/structure/views/add', $view, t('Continue & edit'));
     $this->assertNoFieldById('edit-displays-top-add-display-embed');
+
+    // Configure to hide/show the sql at the preview.
+    $edit = array(
+      'ui_show_sql_query_enabled' => FALSE,
+    );
+    $this->drupalPost('admin/structure/views/settings', $edit, t('Save configuration'));
+    $this->drupalPost('admin/structure/views/add', $view, t('Continue & edit'));
+
+    $this->drupalPost(NULL, array(), t('Update preview'));
+    $xpath = $this->xpath('//div[@class="views-query-info"]/pre');
+    $this->assertEqual(count($xpath), 0, 'The views sql is hidden.');
+
+    $edit = array(
+      'ui_show_sql_query_enabled' => TRUE,
+    );
+    $this->drupalPost('admin/structure/views/settings', $edit, t('Save configuration'));
+    $this->drupalPost('admin/structure/views/add', $view, t('Continue & edit'));
+
+    $this->drupalPost(NULL, array(), t('Update preview'));
+    $xpath = $this->xpath('//div[@class="views-query-info"]//pre');
+    $this->assertEqual(count($xpath), 1, 'The views sql is shown.');
+    $this->assertFalse(strpos($xpath[0], 'db_condition_placeholder') !== FALSE, 'No placeholders are shown in the views sql.');
+    $this->assertTrue(strpos($xpath[0], "node.status = '1'") !== FALSE, 'The placeholders in the views sql is replace by the actual value.');
   }
 
 }
diff --git a/core/modules/views/views_ui/lib/Drupal/views_ui/ViewUI.php b/core/modules/views/views_ui/lib/Drupal/views_ui/ViewUI.php
index 7905b88..059ca8a 100644
--- a/core/modules/views/views_ui/lib/Drupal/views_ui/ViewUI.php
+++ b/core/modules/views/views_ui/lib/Drupal/views_ui/ViewUI.php
@@ -8,6 +8,7 @@
 namespace Drupal\views_ui;
 
 use Drupal\views\ViewExecutable;
+use Drupal\Core\Database\Database;
 
 /**
  * Stores UI related temporary settings.
@@ -1791,7 +1792,7 @@ public function renderPreview($display_id, $args = array()) {
             // Only the sql default class has a method getArguments.
             $quoted = array();
 
-            if (get_class($this->query) == 'views_plugin_query_default') {
+            if (get_class($this->query) == 'Drupal\views\Plugin\views\query\Sql') {
               $quoted = $query->getArguments();
               $connection = Database::getConnection();
               foreach ($quoted as $key => $val) {
