*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.129 2010/01/02 16:57:33 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.130 2010/01/10 04:26:36 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
Datum
nocachegetattr(HeapTuple tuple,
int attnum,
- TupleDesc tupleDesc,
- bool *isnull)
+ TupleDesc tupleDesc)
{
HeapTupleHeader tup = tuple->t_data;
Form_pg_attribute *att = tupleDesc->attrs;
bool slow = false; /* do we have to walk attrs? */
int off; /* current offset within data */
- (void) isnull; /* not used */
-
/* ----------------
* Three cases:
*
* ----------------
*/
-#ifdef IN_MACRO
-/* This is handled in the macro */
- Assert(attnum > 0);
-
- if (isnull)
- *isnull = false;
-#endif
-
attnum--;
- if (HeapTupleNoNulls(tuple))
- {
-#ifdef IN_MACRO
-/* This is handled in the macro */
- if (att[attnum]->attcacheoff >= 0)
- {
- return fetchatt(att[attnum],
- (char *) tup + tup->t_hoff +
- att[attnum]->attcacheoff);
- }
-#endif
- }
- else
+ if (!HeapTupleNoNulls(tuple))
{
/*
* there's a null somewhere in the tuple
*
- * check to see if desired att is null
+ * check to see if any preceding bits are null...
*/
+ int byte = attnum >> 3;
+ int finalbit = attnum & 0x07;
-#ifdef IN_MACRO
-/* This is handled in the macro */
- if (att_isnull(attnum, bp))
- {
- if (isnull)
- *isnull = true;
- return (Datum) NULL;
- }
-#endif
-
- /*
- * Now check to see if any preceding bits are null...
- */
+ /* check for nulls "before" final bit of last byte */
+ if ((~bp[byte]) & ((1 << finalbit) - 1))
+ slow = true;
+ else
{
- int byte = attnum >> 3;
- int finalbit = attnum & 0x07;
+ /* check for nulls in any "earlier" bytes */
+ int i;
- /* check for nulls "before" final bit of last byte */
- if ((~bp[byte]) & ((1 << finalbit) - 1))
- slow = true;
- else
+ for (i = 0; i < byte; i++)
{
- /* check for nulls in any "earlier" bytes */
- int i;
-
- for (i = 0; i < byte; i++)
+ if (bp[i] != 0xFF)
{
- if (bp[i] != 0xFF)
- {
- slow = true;
- break;
- }
+ slow = true;
+ break;
}
}
}
Assert(tup);
/* Currently, no sys attribute ever reads as NULL. */
- if (isnull)
- *isnull = false;
+ *isnull = false;
switch (attnum)
{
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.90 2010/01/02 16:57:33 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.91 2010/01/10 04:26:36 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
Datum
nocache_index_getattr(IndexTuple tup,
int attnum,
- TupleDesc tupleDesc,
- bool *isnull)
+ TupleDesc tupleDesc)
{
Form_pg_attribute *att = tupleDesc->attrs;
char *tp; /* ptr to data part of tuple */
int data_off; /* tuple data offset */
int off; /* current offset within data */
- (void) isnull; /* not used */
-
/* ----------------
* Three cases:
*
* ----------------
*/
-#ifdef IN_MACRO
-/* This is handled in the macro */
- Assert(PointerIsValid(isnull));
- Assert(attnum > 0);
-
- *isnull = false;
-#endif
-
data_off = IndexInfoFindDataOffset(tup->t_info);
attnum--;
- if (!IndexTupleHasNulls(tup))
- {
-#ifdef IN_MACRO
-/* This is handled in the macro */
- if (att[attnum]->attcacheoff >= 0)
- {
- return fetchatt(att[attnum],
- (char *) tup + data_off +
- att[attnum]->attcacheoff);
- }
-#endif
- }
- else
+ if (IndexTupleHasNulls(tup))
{
/*
* there's a null somewhere in the tuple
/* XXX "knows" t_bits are just after fixed tuple header! */
bp = (bits8 *) ((char *) tup + sizeof(IndexTupleData));
-#ifdef IN_MACRO
-/* This is handled in the macro */
-
- if (att_isnull(attnum, bp))
- {
- *isnull = true;
- return (Datum) NULL;
- }
-#endif
-
/*
* Now check to see if any preceding bits are null...
*/
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.280 2010/01/02 16:57:34 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.281 2010/01/10 04:26:36 rhaas Exp $
*
*
* INTERFACE ROUTINES
return (
(attnum) > 0 ?
(
- ((isnull) ? (*(isnull) = false) : (dummyret) NULL),
+ (*(isnull) = false),
HeapTupleNoNulls(tup) ?
(
(tupleDesc)->attrs[(attnum) - 1]->attcacheoff >= 0 ?
(tupleDesc)->attrs[(attnum) - 1]->attcacheoff)
)
:
- nocachegetattr((tup), (attnum), (tupleDesc), (isnull))
+ nocachegetattr((tup), (attnum), (tupleDesc))
)
:
(
att_isnull((attnum) - 1, (tup)->t_data->t_bits) ?
(
- ((isnull) ? (*(isnull) = true) : (dummyret) NULL),
+ (*(isnull) = true),
(Datum) NULL
)
:
(
- nocachegetattr((tup), (attnum), (tupleDesc), (isnull))
+ nocachegetattr((tup), (attnum), (tupleDesc))
)
)
)
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/htup.h,v 1.109 2010/01/02 16:58:00 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/access/htup.h,v 1.110 2010/01/10 04:26:36 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
#define fastgetattr(tup, attnum, tupleDesc, isnull) \
( \
AssertMacro((attnum) > 0), \
- (((isnull) != NULL) ? (*(isnull) = false) : (dummyret)NULL), \
+ (*(isnull) = false), \
HeapTupleNoNulls(tup) ? \
( \
(tupleDesc)->attrs[(attnum)-1]->attcacheoff >= 0 ? \
(tupleDesc)->attrs[(attnum)-1]->attcacheoff) \
) \
: \
- nocachegetattr((tup), (attnum), (tupleDesc), (isnull)) \
+ nocachegetattr((tup), (attnum), (tupleDesc)) \
) \
: \
( \
att_isnull((attnum)-1, (tup)->t_data->t_bits) ? \
( \
- (((isnull) != NULL) ? (*(isnull) = true) : (dummyret)NULL), \
+ (*(isnull) = true), \
(Datum)NULL \
) \
: \
( \
- nocachegetattr((tup), (attnum), (tupleDesc), (isnull)) \
+ nocachegetattr((tup), (attnum), (tupleDesc)) \
) \
) \
)
( \
((attnum) > (int) HeapTupleHeaderGetNatts((tup)->t_data)) ? \
( \
- (((isnull) != NULL) ? (*(isnull) = true) : (dummyret)NULL), \
+ (*(isnull) = true), \
(Datum)NULL \
) \
: \
uint16 *infomask, bits8 *bit);
extern bool heap_attisnull(HeapTuple tup, int attnum);
extern Datum nocachegetattr(HeapTuple tup, int attnum,
- TupleDesc att, bool *isnull);
+ TupleDesc att);
extern Datum heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
bool *isnull);
extern HeapTuple heap_copytuple(HeapTuple tuple);
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/itup.h,v 1.53 2010/01/02 16:58:00 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/access/itup.h,v 1.54 2010/01/10 04:26:36 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
+ (tupleDesc)->attrs[(attnum)-1]->attcacheoff) \
) \
: \
- nocache_index_getattr((tup), (attnum), (tupleDesc), (isnull)) \
+ nocache_index_getattr((tup), (attnum), (tupleDesc)) \
) \
: \
( \
) \
: \
( \
- nocache_index_getattr((tup), (attnum), (tupleDesc), (isnull)) \
+ nocache_index_getattr((tup), (attnum), (tupleDesc)) \
) \
) \
)
extern IndexTuple index_form_tuple(TupleDesc tupleDescriptor,
Datum *values, bool *isnull);
extern Datum nocache_index_getattr(IndexTuple tup, int attnum,
- TupleDesc tupleDesc, bool *isnull);
+ TupleDesc tupleDesc);
extern void index_deform_tuple(IndexTuple tup, TupleDesc tupleDescriptor,
Datum *values, bool *isnull);
extern IndexTuple CopyIndexTuple(IndexTuple source);