mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Inlined heap_getattr().
This commit is contained in:
		@@ -8,7 +8,7 @@
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 * IDENTIFICATION
 | 
			
		||||
 *    $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.20 1997/08/24 23:07:26 momjian Exp $
 | 
			
		||||
 *    $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.21 1997/08/26 23:31:20 momjian Exp $
 | 
			
		||||
 *
 | 
			
		||||
 * NOTES
 | 
			
		||||
 *    The old interface functions have been converted to macros
 | 
			
		||||
@@ -39,8 +39,6 @@
 | 
			
		||||
#define register
 | 
			
		||||
#endif /* !NO_ASSERT_CHECKING && sparc && sunos4 */
 | 
			
		||||
 | 
			
		||||
static char *heap_getsysattr(HeapTuple tup, Buffer b, int attnum);
 | 
			
		||||
 | 
			
		||||
/* ----------------------------------------------------------------
 | 
			
		||||
 *			misc support routines
 | 
			
		||||
 * ----------------------------------------------------------------
 | 
			
		||||
@@ -337,7 +335,7 @@ heap_sysattrbyval(AttrNumber attno)
 | 
			
		||||
 *	heap_getsysattr
 | 
			
		||||
 * ----------------
 | 
			
		||||
 */
 | 
			
		||||
static char *
 | 
			
		||||
char *
 | 
			
		||||
heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
 | 
			
		||||
{
 | 
			
		||||
    switch (attnum) {
 | 
			
		||||
@@ -423,7 +421,6 @@ fastgetattr(HeapTuple tup,
 | 
			
		||||
     * ----------------
 | 
			
		||||
     */
 | 
			
		||||
    
 | 
			
		||||
    Assert(PointerIsValid(isnull));
 | 
			
		||||
    Assert(attnum > 0);
 | 
			
		||||
    
 | 
			
		||||
    /* ----------------
 | 
			
		||||
@@ -435,7 +432,8 @@ fastgetattr(HeapTuple tup,
 | 
			
		||||
     * ----------------
 | 
			
		||||
     */
 | 
			
		||||
    
 | 
			
		||||
    *isnull =  false;
 | 
			
		||||
    if (isnull)
 | 
			
		||||
	*isnull =  false;
 | 
			
		||||
    
 | 
			
		||||
    if (HeapTupleNoNulls(tup)) {
 | 
			
		||||
	attnum--;
 | 
			
		||||
@@ -469,7 +467,8 @@ fastgetattr(HeapTuple tup,
 | 
			
		||||
	 */
 | 
			
		||||
	
 | 
			
		||||
	if (att_isnull(attnum, bp)) {
 | 
			
		||||
	    *isnull = true;
 | 
			
		||||
	    if (isnull)
 | 
			
		||||
		*isnull = true;
 | 
			
		||||
	    return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -659,58 +658,6 @@ fastgetattr(HeapTuple tup,
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* ----------------
 | 
			
		||||
 *      heap_getattr
 | 
			
		||||
 *
 | 
			
		||||
 *      Find a particular field in a row represented as a heap tuple.
 | 
			
		||||
 *      We return a pointer into that heap tuple, which points to the
 | 
			
		||||
 *      first byte of the value of the field in question.
 | 
			
		||||
 *
 | 
			
		||||
 *      If the field in question has a NULL value, we return a null
 | 
			
		||||
 *      pointer and return <*isnull> == true.  Otherwise, we return
 | 
			
		||||
 *      <*isnull> == false.
 | 
			
		||||
 *
 | 
			
		||||
 *      <tup> is the pointer to the heap tuple.  <attnum> is the attribute
 | 
			
		||||
 *      number of the column (field) caller wants.  <tupleDesc> is a 
 | 
			
		||||
 *      pointer to the structure describing the row and all its fields.
 | 
			
		||||
 * ---------------- */
 | 
			
		||||
char *
 | 
			
		||||
heap_getattr(HeapTuple tup,
 | 
			
		||||
             Buffer b,
 | 
			
		||||
             int attnum,
 | 
			
		||||
             TupleDesc tupleDesc,
 | 
			
		||||
             bool *isnull)
 | 
			
		||||
{
 | 
			
		||||
    bool        localIsNull;
 | 
			
		||||
 | 
			
		||||
    /* ----------------
 | 
			
		||||
     *  sanity checks
 | 
			
		||||
     * ----------------
 | 
			
		||||
     */
 | 
			
		||||
    Assert(tup != NULL);
 | 
			
		||||
    
 | 
			
		||||
    if (! PointerIsValid(isnull))
 | 
			
		||||
        isnull = &localIsNull;
 | 
			
		||||
    
 | 
			
		||||
    if (attnum > (int) tup->t_natts) {
 | 
			
		||||
        *isnull = true;
 | 
			
		||||
        return ((char *) NULL);
 | 
			
		||||
    } else if (attnum > 0) {
 | 
			
		||||
	/* ----------------
 | 
			
		||||
	 *  take care of user defined attributes
 | 
			
		||||
	 * ----------------
 | 
			
		||||
	 */
 | 
			
		||||
        return fastgetattr(tup, attnum, tupleDesc, isnull);
 | 
			
		||||
    } else {
 | 
			
		||||
	/* ----------------
 | 
			
		||||
	 *  take care of system attributes
 | 
			
		||||
	 * ----------------
 | 
			
		||||
	 */
 | 
			
		||||
	*isnull = false;
 | 
			
		||||
	return heap_getsysattr(tup, b, attnum);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* ----------------
 | 
			
		||||
 *	heap_copytuple
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 * IDENTIFICATION
 | 
			
		||||
 *    $Header: /cvsroot/pgsql/src/backend/access/common/Attic/heapvalid.c,v 1.14 1997/08/24 23:07:26 momjian Exp $
 | 
			
		||||
 *    $Header: /cvsroot/pgsql/src/backend/access/common/Attic/heapvalid.c,v 1.15 1997/08/26 23:31:22 momjian Exp $
 | 
			
		||||
 *
 | 
			
		||||
 *-------------------------------------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
@@ -15,7 +15,7 @@
 | 
			
		||||
#include <postgres.h>
 | 
			
		||||
 | 
			
		||||
#include <fmgr.h>
 | 
			
		||||
#include <access/heaptuple.h>
 | 
			
		||||
#include <access/heapam.h>
 | 
			
		||||
#include <access/valid.h>
 | 
			
		||||
#include <access/xact.h>
 | 
			
		||||
#include <storage/bufpage.h>
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 * IDENTIFICATION
 | 
			
		||||
 *    $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.14 1997/08/18 20:51:30 momjian Exp $
 | 
			
		||||
 *    $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.15 1997/08/26 23:31:23 momjian Exp $
 | 
			
		||||
 *
 | 
			
		||||
 *-------------------------------------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
@@ -17,7 +17,7 @@
 | 
			
		||||
#include <postgres.h>
 | 
			
		||||
 | 
			
		||||
#include <fmgr.h> 
 | 
			
		||||
#include <access/heaptuple.h> 
 | 
			
		||||
#include <access/heapam.h> 
 | 
			
		||||
#include <access/printtup.h> 
 | 
			
		||||
#include <catalog/pg_type.h>
 | 
			
		||||
#include <libpq/libpq.h>
 | 
			
		||||
@@ -91,7 +91,8 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
 | 
			
		||||
    j = 0;
 | 
			
		||||
    k = 1 << 7;
 | 
			
		||||
    for (i = 0; i < tuple->t_natts; ) {
 | 
			
		||||
	attr = heap_getattr(tuple, InvalidBuffer, ++i, typeinfo, &isnull);
 | 
			
		||||
    	i++; /* heap_getattr is a macro, so no increment */
 | 
			
		||||
	attr = heap_getattr(tuple, InvalidBuffer, i, typeinfo, &isnull);
 | 
			
		||||
	if (!isnull)
 | 
			
		||||
	    j |= k;
 | 
			
		||||
	k >>= 1;
 | 
			
		||||
@@ -214,7 +215,8 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
 | 
			
		||||
    j = 0;
 | 
			
		||||
    k = 1 << 7;
 | 
			
		||||
    for (i = 0; i < tuple->t_natts; ) {
 | 
			
		||||
	attr = heap_getattr(tuple, InvalidBuffer, ++i, typeinfo, &isnull);
 | 
			
		||||
    	i++; /* heap_getattr is a macro, so no increment */
 | 
			
		||||
	attr = heap_getattr(tuple, InvalidBuffer, i, typeinfo, &isnull);
 | 
			
		||||
	if (!isnull)
 | 
			
		||||
	    j |= k;
 | 
			
		||||
	k >>= 1;
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 * IDENTIFICATION
 | 
			
		||||
 *    $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.12 1997/08/19 21:29:30 momjian Exp $
 | 
			
		||||
 *    $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.13 1997/08/26 23:31:28 momjian Exp $
 | 
			
		||||
 *
 | 
			
		||||
 * INTERFACE ROUTINES
 | 
			
		||||
 *	index_open 	- open an index relation by relationId
 | 
			
		||||
@@ -69,7 +69,7 @@
 | 
			
		||||
#include <utils/relcache.h>
 | 
			
		||||
#include <fmgr.h>
 | 
			
		||||
#include <storage/lmgr.h>
 | 
			
		||||
#include <access/heaptuple.h>
 | 
			
		||||
#include <access/heapam.h>
 | 
			
		||||
 | 
			
		||||
/* ----------------
 | 
			
		||||
 *   undefine macros we aren't going to use that would otherwise
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 * IDENTIFICATION
 | 
			
		||||
 *    $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.4 1997/01/10 20:17:25 momjian Exp $
 | 
			
		||||
 *    $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.5 1997/08/26 23:31:37 momjian Exp $
 | 
			
		||||
 *
 | 
			
		||||
 *-------------------------------------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
@@ -17,7 +17,6 @@
 | 
			
		||||
#include "postgres.h"
 | 
			
		||||
 | 
			
		||||
#include "utils/palloc.h"
 | 
			
		||||
#include "access/heaptuple.h"
 | 
			
		||||
#include "access/heapam.h"
 | 
			
		||||
#include "executor/executor.h"
 | 
			
		||||
#include "nodes/relation.h"
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 * IDENTIFICATION
 | 
			
		||||
 *    $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.6 1997/01/10 20:17:38 momjian Exp $
 | 
			
		||||
 *    $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.7 1997/08/26 23:31:44 momjian Exp $
 | 
			
		||||
 *
 | 
			
		||||
 *-------------------------------------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
@@ -31,7 +31,6 @@
 | 
			
		||||
#include "executor/nodeUnique.h"
 | 
			
		||||
#include "optimizer/clauses.h"
 | 
			
		||||
#include "access/heapam.h"
 | 
			
		||||
#include "access/heaptuple.h"
 | 
			
		||||
#include "access/printtup.h" /* for typtoout() */
 | 
			
		||||
#include "utils/builtins.h"  /* for namecpy()*/
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user