diff --git a/core/lib/Drupal/Core/Database/InvalidQueryException.php b/core/lib/Drupal/Core/Database/InvalidQueryException.php
new file mode 100644
index 0000000..ffd5bab
--- /dev/null
+++ b/core/lib/Drupal/Core/Database/InvalidQueryException.php
@@ -0,0 +1,16 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\Core\Database\IntegrityConstraintViolationException
+ */
+
+namespace Drupal\Core\Database;
+
+/**
+ * Exception thrown if a query would be invalidt.
+ *
+ * This exception is thrown e.g. when trying to have an IN condition with an
+ * empty array.
+ */
+class InvalidQueryException extends \InvalidArgumentException implements DatabaseException { }
diff --git a/core/lib/Drupal/Core/Database/Query/Condition.php b/core/lib/Drupal/Core/Database/Query/Condition.php
index 3b5fe9e..8dee80f 100644
--- a/core/lib/Drupal/Core/Database/Query/Condition.php
+++ b/core/lib/Drupal/Core/Database/Query/Condition.php
@@ -8,6 +8,7 @@
 namespace Drupal\Core\Database\Query;
 
 use Drupal\Core\Database\Connection;
+use Drupal\Core\Database\InvalidQueryException;
 
 /**
  * Generic class for a series of conditions in a query.
@@ -76,6 +77,10 @@ public function condition($field, $value = NULL, $operator = NULL) {
         $operator = '=';
       }
     }
+    if (is_array($value) && empty($value)) {
+      throw new InvalidQueryException(sprintf("Query condition '%s %s ()' cannot be empty.", $field, $operator));
+    }
+
     $this->conditions[] = array(
       'field' => $field,
       'value' => $value,
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/SelectTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/SelectTest.php
index d9da2d6..bbb24da 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/SelectTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/SelectTest.php
@@ -6,6 +6,7 @@
  */
 
 namespace Drupal\system\Tests\Database;
+use Drupal\Core\Database\InvalidQueryException;
 
 /**
  * Tests the SELECT builder.
@@ -481,4 +482,29 @@ function testInvalidSelectCount() {
     $this->fail('No Exception thrown.');
   }
 
+  /**
+   * Tests thrown exception for IN query conditions with an empty array.
+   */
+  function testEmptyInCondition() {
+    try {
+      db_select('test', 't')
+        ->fields('t')
+        ->condition('age', array(), 'IN')
+        ->execute();
+    }
+    catch (InvalidQueryException $e) {
+      $this->assertEqual("Query condition 'age IN ()' cannot be empty.", $e->getMessage());
+    }
+
+    try {
+      db_select('test', 't')
+        ->fields('t')
+        ->condition('age', array(), 'NOT IN')
+        ->execute();
+    }
+    catch (InvalidQueryException $e) {
+      $this->assertEqual("Query condition 'age NOT IN ()' cannot be empty.", $e->getMessage());
+    }
+  }
+
 }
