On Mon, 24 Apr 2006, Gevik Babakhani wrote:
I noticed the following compile warnings. Perhaps someone is interested to know about them.
Also I was testing a gcc 4.2 snapshot (20060419) and it has a whole lot of warnings stemming from heap_getattr's isnull check:
aclchk.c:791: warning: the address of 'isNull', will always evaluate as 'true'
aclDatum = heap_getattr(tuple, Anum_pg_database_datacl, RelationGetDescr(relation), &isNull);
#define heap_getattr(tup, attnum, tupleDesc, isnull) \
( \
AssertMacro((tup) != NULL), \
( \
((attnum) > 0) ? \
( \
((attnum) > (int) (tup)->t_data->t_natts) ? \
( \
((isnull) ? (*(isnull) = true) : (dummyret)NULL), \
(Datum)NULL \
) \
: \
fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \
) \
: \
heap_getsysattr((tup), (attnum), (tupleDesc), (isnull)) \
) \
)
Removing the check for (isnull) before (*(isnull) = true) as in the
attached patch passes make check, but I have not looked at every
heap_getattr call site to ensure it's passing a valid isnull pointer.
Kris Jurka
Index: src/include/access/heapam.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/access/heapam.h,v
retrieving revision 1.107
diff -c -r1.107 heapam.h
*** src/include/access/heapam.h 24 Mar 2006 04:32:13 -0000 1.107
--- src/include/access/heapam.h 24 Apr 2006 18:12:16 -0000
***************
*** 45,51 ****
#define fastgetattr(tup, attnum, tupleDesc, isnull)
\
(
\
AssertMacro((attnum) > 0),
\
! ((isnull) ? (*(isnull) = false) : (dummyret)NULL),
\
HeapTupleNoNulls(tup) ?
\
(
\
(tupleDesc)->attrs[(attnum)-1]->attcacheoff >= 0 ?
\
--- 45,51 ----
#define fastgetattr(tup, attnum, tupleDesc, isnull)
\
(
\
AssertMacro((attnum) > 0),
\
! (*(isnull) = false),
\
HeapTupleNoNulls(tup) ?
\
(
\
(tupleDesc)->attrs[(attnum)-1]->attcacheoff >= 0 ?
\
***************
*** 61,67 ****
(
\
att_isnull((attnum)-1, (tup)->t_data->t_bits) ?
\
(
\
! ((isnull) ? (*(isnull) = true) : (dummyret)NULL),
\
(Datum)NULL
\
)
\
:
\
--- 61,67 ----
(
\
att_isnull((attnum)-1, (tup)->t_data->t_bits) ?
\
(
\
! (*(isnull) = true),
\
(Datum)NULL
\
)
\
:
\
***************
*** 100,106 ****
( \
((attnum) > (int) (tup)->t_data->t_natts) ? \
( \
! ((isnull) ? (*(isnull) = true) :
(dummyret)NULL), \
(Datum)NULL \
) \
: \
--- 100,106 ----
( \
((attnum) > (int) (tup)->t_data->t_natts) ? \
( \
! (*(isnull) = true), \
(Datum)NULL \
) \
: \
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match
