Adjust DatumGetBool macro so that it isn't fooled by garbage in the Datum

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 23a41573c4fcf32c406d5c4a81a4f2645dbd8304
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2007-03-23T20:24:41Z
Releases: 8.3.0
Adjust DatumGetBool macro so that it isn't fooled by garbage in the Datum
to the left of the actual bool value.  While in most cases there won't be
any, our support for old-style user-defined functions violates the C spec
to the extent of calling functions that might return char or short through
a function pointer declared to return "char *", which we then coerce to
Datum.  It is not surprising that the result might contain garbage
high-order bits ... what is surprising is that we didn't see such cases
long ago.  Per report from Magnus.

Files

PathChange+/−
src/include/postgres.h modified +11 −5