8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.24 1997/09/08 21:40:18 momjian Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.25 1997/09/12 04:07:06 momjian Exp $
12
12
*
13
13
* NOTES
14
14
* The old interface functions have been converted to macros
@@ -372,25 +372,25 @@ heap_sysattrbyval(AttrNumber attno)
372
372
* heap_getsysattr
373
373
* ----------------
374
374
*/
375
- char *
375
+ Datum
376
376
heap_getsysattr (HeapTuple tup , Buffer b , int attnum )
377
377
{
378
378
switch (attnum )
379
379
{
380
380
case SelfItemPointerAttributeNumber :
381
- return ((char * ) & tup -> t_ctid );
381
+ return ((Datum ) & tup -> t_ctid );
382
382
case ObjectIdAttributeNumber :
383
- return ((char * ) (long ) tup -> t_oid );
383
+ return ((Datum ) (long ) tup -> t_oid );
384
384
case MinTransactionIdAttributeNumber :
385
- return ((char * ) (long ) tup -> t_xmin );
385
+ return ((Datum ) (long ) tup -> t_xmin );
386
386
case MinCommandIdAttributeNumber :
387
- return ((char * ) (long ) tup -> t_cmin );
387
+ return ((Datum ) (long ) tup -> t_cmin );
388
388
case MaxTransactionIdAttributeNumber :
389
- return ((char * ) (long ) tup -> t_xmax );
389
+ return ((Datum ) (long ) tup -> t_xmax );
390
390
case MaxCommandIdAttributeNumber :
391
- return ((char * ) (long ) tup -> t_cmax );
391
+ return ((Datum ) (long ) tup -> t_cmax );
392
392
case ChainItemPointerAttributeNumber :
393
- return ((char * ) & tup -> t_chain );
393
+ return ((Datum ) & tup -> t_chain );
394
394
case AnchorItemPointerAttributeNumber :
395
395
elog (WARN , "heap_getsysattr: t_anchor does not exist!" );
396
396
break ;
@@ -409,7 +409,7 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
409
409
if (!AbsoluteTimeIsBackwardCompatiblyValid (tup -> t_tmin ) &&
410
410
TransactionIdDidCommit (tup -> t_xmin ))
411
411
tup -> t_tmin = TransactionIdGetCommitTime (tup -> t_xmin );
412
- return ((char * ) (long ) tup -> t_tmin );
412
+ return ((Datum ) (long ) tup -> t_tmin );
413
413
case MaxAbsoluteTimeAttributeNumber :
414
414
if (!AbsoluteTimeIsBackwardCompatiblyReal (tup -> t_tmax ))
415
415
{
@@ -418,9 +418,9 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
418
418
else
419
419
tup -> t_tmax = CURRENT_ABSTIME ;
420
420
}
421
- return ((char * ) (long ) tup -> t_tmax );
421
+ return ((Datum ) (long ) tup -> t_tmax );
422
422
case VersionTypeAttributeNumber :
423
- return ((char * ) (long ) tup -> t_vtype );
423
+ return ((Datum ) (long ) tup -> t_vtype );
424
424
default :
425
425
elog (WARN , "heap_getsysattr: undefined attnum %d" , attnum );
426
426
}
@@ -444,7 +444,7 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
444
444
* the same attribute descriptor will go much quicker. -cim 5/4/91
445
445
* ----------------
446
446
*/
447
- char *
447
+ Datum
448
448
fastgetattr (HeapTuple tup ,
449
449
int attnum ,
450
450
TupleDesc tupleDesc ,
@@ -479,7 +479,7 @@ fastgetattr(HeapTuple tup,
479
479
attnum -- ;
480
480
if (att [attnum ]-> attcacheoff > 0 )
481
481
{
482
- return (char * )
482
+ return (Datum )
483
483
fetchatt (& (att [attnum ]),
484
484
(char * ) tup + tup -> t_hoff + att [attnum ]-> attcacheoff );
485
485
}
@@ -489,7 +489,7 @@ fastgetattr(HeapTuple tup,
489
489
/*
490
490
* first attribute is always at position zero
491
491
*/
492
- return ((char * ) fetchatt (& (att [0 ]), (char * ) tup + tup -> t_hoff ));
492
+ return ((Datum ) fetchatt (& (att [0 ]), (char * ) tup + tup -> t_hoff ));
493
493
}
494
494
495
495
tp = (char * ) tup + tup -> t_hoff ;
@@ -543,13 +543,13 @@ fastgetattr(HeapTuple tup,
543
543
{
544
544
if (att [attnum ]-> attcacheoff > 0 )
545
545
{
546
- return (char * )
546
+ return (Datum )
547
547
fetchatt (& (att [attnum ]),
548
548
tp + att [attnum ]-> attcacheoff );
549
549
}
550
550
else if (attnum == 0 )
551
551
{
552
- return (char * )
552
+ return (Datum )
553
553
fetchatt (& (att [0 ]), (char * ) tup + tup -> t_hoff );
554
554
}
555
555
else if (!HeapTupleAllFixed (tup ))
@@ -618,7 +618,7 @@ fastgetattr(HeapTuple tup,
618
618
}
619
619
620
620
return
621
- (char * ) fetchatt (& (att [attnum ]), tp + att [attnum ]-> attcacheoff );
621
+ (Datum ) fetchatt (& (att [attnum ]), tp + att [attnum ]-> attcacheoff );
622
622
}
623
623
else
624
624
{
@@ -729,7 +729,7 @@ fastgetattr(HeapTuple tup,
729
729
off = LONGALIGN (off );
730
730
break ;
731
731
}
732
- return ((char * ) fetchatt (& (att [attnum ]), tp + off ));
732
+ return ((Datum ) fetchatt (& (att [attnum ]), tp + off ));
733
733
}
734
734
}
735
735
@@ -782,11 +782,11 @@ heap_deformtuple(HeapTuple tuple,
782
782
{
783
783
bool isnull ;
784
784
785
- values [i ] = ( Datum ) heap_getattr (tuple ,
786
- InvalidBuffer ,
787
- i + 1 ,
788
- tdesc ,
789
- & isnull );
785
+ values [i ] = heap_getattr (tuple ,
786
+ InvalidBuffer ,
787
+ i + 1 ,
788
+ tdesc ,
789
+ & isnull );
790
790
if (isnull )
791
791
nulls [i ] = 'n' ;
792
792
else
@@ -936,15 +936,12 @@ heap_modifytuple(HeapTuple tuple,
936
936
937
937
if (repl [attoff ] == ' ' )
938
938
{
939
- char * attr ;
940
-
941
- attr =
939
+ value [attoff ] =
942
940
heap_getattr (tuple ,
943
941
InvalidBuffer ,
944
942
AttrOffsetGetAttrNumber (attoff ),
945
943
RelationGetTupleDescriptor (relation ),
946
944
& isNull );
947
- value [attoff ] = PointerGetDatum (attr );
948
945
nulls [attoff ] = (isNull ) ? 'n' : ' ' ;
949
946
950
947
}
0 commit comments