Skip to content

Commit cb253de

Browse files
committed
Don't mess with HEAP_XMAX_INVALID in heaptuple.c routines; there is
no reason to worry about the tuple commit status bits until the tuple is inserted in a relation by heapam.c. Also, improve comments for heap_addheader().
1 parent 0b1b377 commit cb253de

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/backend/access/common/heaptuple.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.82 2002/09/04 20:31:08 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.83 2002/09/27 15:04:08 tgl Exp $
1313
*
1414
* NOTES
1515
* The old interface functions have been converted to macros
@@ -617,18 +617,16 @@ heap_formtuple(TupleDesc tupleDescriptor,
617617
td->t_natts = numberOfAttributes;
618618
td->t_hoff = hoff;
619619

620+
if (tupleDescriptor->tdhasoid) /* else leave infomask = 0 */
621+
td->t_infomask = HEAP_HASOID;
622+
620623
DataFill((char *) td + hoff,
621624
tupleDescriptor,
622625
value,
623626
nulls,
624627
&td->t_infomask,
625628
(hasnull ? td->t_bits : NULL));
626629

627-
if (tupleDescriptor->tdhasoid)
628-
td->t_infomask |= HEAP_HASOID;
629-
630-
td->t_infomask |= HEAP_XMAX_INVALID;
631-
632630
return tuple;
633631
}
634632

@@ -736,8 +734,12 @@ heap_freetuple(HeapTuple htup)
736734
*
737735
* This routine forms a HeapTuple by copying the given structure (tuple
738736
* data) and adding a generic header. Note that the tuple data is
739-
* presumed to contain no null fields. It is typically only useful
740-
* for null-free system tables.
737+
* presumed to contain no null fields and no varlena fields.
738+
*
739+
* This routine is really only useful for certain system tables that are
740+
* known to be fixed-width and null-free. It is used in some places for
741+
* pg_class, but that is a gross hack (it only works because relacl can
742+
* be omitted from the tuple entirely in those places).
741743
* ----------------
742744
*/
743745
HeapTuple
@@ -770,9 +772,11 @@ heap_addheader(int natts, /* max domain index */
770772

771773
MemSet((char *) td, 0, hoff);
772774

773-
td->t_hoff = hoff;
774775
td->t_natts = natts;
775-
td->t_infomask = withoid ? (HEAP_XMAX_INVALID | HEAP_HASOID) : HEAP_XMAX_INVALID;
776+
td->t_hoff = hoff;
777+
778+
if (withoid) /* else leave infomask = 0 */
779+
td->t_infomask = HEAP_HASOID;
776780

777781
memcpy((char *) td + hoff, structure, structlen);
778782

0 commit comments

Comments
 (0)