diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/rules.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/rules.scala
index 7ac62fb191d40689335649eff99f36a3810850f3..543389efd5b956ddbc44b1a326289b7fdf5f21b2 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/rules.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/rules.scala
@@ -78,8 +78,9 @@ private[sql] object PreInsertCastAndRename extends Rule[LogicalPlan] {
         // schema of the relation.
         if (l.output.size != child.output.size) {
           sys.error(
-            s"$l requires that the query in the SELECT clause of the INSERT INTO/OVERWRITE " +
-              s"statement generates the same number of columns as its schema.")
+            s"$l requires that the data to be inserted have the same number of columns as the " +
+              s"target table: target table has ${l.output.size} column(s) but " +
+              s"the inserted data has ${child.output.size} column(s).")
         }
         castAndRenameChildOutput(i, l.output, child)
   }
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala
index bade41b1eddf9895c922fe7382eef4a16c262b72..d7179551d62dfe4110c06d491ee53ffd759d55fa 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala
@@ -95,7 +95,7 @@ class InsertSuite extends DataSourceTest with SharedSQLContext {
       """.stripMargin)
     }.getMessage
     assert(
-      message.contains("generates the same number of columns as its schema"),
+      message.contains("requires that the data to be inserted have the same number of columns"),
       "SELECT clause generating a different number of columns should not be not allowed."
     )
   }