--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -1267,10 +1267,9 @@ Datum
 array_recv(PG_FUNCTION_ARGS)
 {
 	StringInfo	buf = (StringInfo) PG_GETARG_POINTER(0);
-	Oid			spec_element_type = PG_GETARG_OID(1);	/* type of an array
+	Oid			element_type = PG_GETARG_OID(1);	/* type of an array
 														 * element */
 	int32		typmod = PG_GETARG_INT32(2);	/* typmod for array elements */
-	Oid			element_type;
 	int			typlen;
 	bool		typbyval;
 	char		typalign;
@@ -1307,14 +1306,12 @@ array_recv(PG_FUNCTION_ARGS)
 				(errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
 				 errmsg("invalid array flags")));
 
-	element_type = pq_getmsgint(buf, sizeof(Oid));
-	if (element_type != spec_element_type)
-	{
-		/* XXX Can we allow taking the input element type in any cases? */
-		ereport(ERROR,
-				(errcode(ERRCODE_DATATYPE_MISMATCH),
-				 errmsg("wrong element type")));
-	}
+	/*
+	 * ignore element_type stored in binary data. We already know the type.
+	 * The stored type can actually be different from the type here, because
+	 * OIDs do not necessarily match between different installations.
+	 */
+	pq_getmsgint(buf, sizeof(Oid));
 
 	for (i = 0; i < ndim; i++)
 	{
