OSDN Git Service

Adjust DatumGetBool macro so that it isn't fooled by garbage in the Datum
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 23 Mar 2007 20:24:41 +0000 (20:24 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 23 Mar 2007 20:24:41 +0000 (20:24 +0000)
commit23a41573c4fcf32c406d5c4a81a4f2645dbd8304
treecf6b4710a380803f329d392614d9510d9100a62e
parent547b6e537aa8bbae83a8a4c4d0d7f216390bdb9c
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.
src/include/postgres.h