]> granicus.if.org Git - postgresql/commit
Adjust DatumGetBool macro so that it isn't fooled by garbage in the Datum
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 25 Mar 2008 19:31:46 +0000 (19:31 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 25 Mar 2008 19:31:46 +0000 (19:31 +0000)
commitc1df51585f17073ea47b63024ca1c8dfa3a944f8
treef79c8e8e4e62be12bf264acdcf055994f8dfa475
parentb775a3257b33bb22eca6ea77d3f49b2f14e2b732
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.

This is a back-patch of a change that was made in HEAD almost exactly
a year ago.  I had refrained from back-patching at the time, but now
we find that this is *necessary* for contrib to work with gcc 4.3.
src/include/postgres.h