pgsql: Adjust DatumGetBool macro so that it isn't fooled by garbage in

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Adjust DatumGetBool macro so that it isn't fooled by garbage in
Date: 2007-03-23 20:24:41
Message-ID: 20070323202441.95A009FB68B@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
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.

Modified Files:
--------------
pgsql/src/include:
postgres.h (r1.77 -> r1.78)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/postgres.h.diff?r1=1.77&r2=1.78)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2007-03-23 20:56:40 pgsql: We no longer need to palloc the VacuumStmt node; keeping it on
Previous Message Tom Lane 2007-03-23 19:53:52 pgsql: Fix plancache so that any required replanning is done with the