Bruce Momjian <bruce@momjian.us> wrote:
> I am seeing this compiler warning in git head:
>
> rowtypes.c: In function 'record_image_cmp':
> rowtypes.c:1433: warning: 'cmpresult' may be used
> uninitialized in this function rowtypes.c:1433: note: 'cmpresult' was declared here
I had not gotten a warning under either gcc or clang, but that was
probably because I was doing assert-enabled builds, and the
Assert(false) saved me. That seemed a little marginal anyway, so
how about this?:
diff --git a/src/backend/utils/adt/rowtypes.c b/src/backend/utils/adt/rowtypes.c
index ae007cf..0332593 100644
--- a/src/backend/utils/adt/rowtypes.c
+++ b/src/backend/utils/adt/rowtypes.c
@@ -1508,7 +1508,11 @@ 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));
}
}
else
Does that fix the warning for you?
--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company