diff --git a/src/backend/utils/adt/rowtypes.c b/src/backend/utils/adt/rowtypes.c
index 33647f7..a0e1a1a 100644
--- a/src/backend/utils/adt/rowtypes.c
+++ b/src/backend/utils/adt/rowtypes.c
@@ -1400,7 +1400,7 @@ record_image_cmp(FunctionCallInfo fcinfo)
 		 */
 		if (!nulls1[i1] || !nulls2[i2])
 		{
-			int			cmpresult = 0;
+			int			cmpresult;
 
 			if (nulls1[i1])
 			{
@@ -1478,7 +1478,12 @@ record_image_cmp(FunctionCallInfo fcinfo)
 						break;
 #endif
 					default:
-						Assert(false);	/* cannot happen */
+						/* cannot happen */
+						elog(ERROR,
+							 "unexpected length of %i found comparing columns of type %s",
+							 (int) tupdesc1->attrs[i1]->attlen,
+							 format_type_be(tupdesc1->attrs[i1]->atttypid));
+						cmpresult = 0;  /* make compiler happy */
 				}
 			}
 			else
@@ -1729,7 +1734,12 @@ record_image_eq(PG_FUNCTION_ARGS)
 						break;
 #endif
 					default:
-						Assert(false);	/* cannot happen */
+						/* cannot happen */
+						elog(ERROR,
+							 "unexpected length of %i found comparing columns of type %s",
+							 (int) tupdesc1->attrs[i1]->attlen,
+							 format_type_be(tupdesc1->attrs[i1]->atttypid));
+						result = false;  /* make compiler happy */
 				}
 			}
 			else
