diff -ruN ../base/src/backend/access/common/heaptuple.c src/backend/access/common/heaptuple.c --- ../base/src/backend/access/common/heaptuple.c 2002-07-16 19:35:34.000000000 +0200 +++ src/backend/access/common/heaptuple.c 2002-07-16 19:58:01.000000000 +0200 @@ -597,6 +597,9 @@ if (hasnull) len += BITMAPLEN(numberOfAttributes); + if (tupleDescriptor->tdhasoid == WITHOID) + len += sizeof(Oid); + hoff = len = MAXALIGN(len); /* align user data safely */ len += ComputeDataSize(tupleDescriptor, value, nulls); @@ -757,8 +760,8 @@ /* header needs no null bitmap */ hoff = offsetof(HeapTupleHeaderData, t_bits); - /*if (withoid) - hoff += sizeof(Oid);*/ + if (withoid) + hoff += sizeof(Oid); hoff = MAXALIGN(hoff); len = hoff + structlen; diff -ruN ../base/src/backend/access/heap/tuptoaster.c src/backend/access/heap/tuptoaster.c --- ../base/src/backend/access/heap/tuptoaster.c 2002-05-27 23:52:41.000000000 +0200 +++ src/backend/access/heap/tuptoaster.c 2002-07-16 19:58:01.000000000 +0200 @@ -726,6 +726,8 @@ new_len = offsetof(HeapTupleHeaderData, t_bits); if (has_nulls) new_len += BITMAPLEN(numAttrs); + if (rel->rd_rel->relhasoids) + new_len += sizeof(Oid); new_len = MAXALIGN(new_len); Assert(new_len == olddata->t_hoff); new_len += ComputeDataSize(tupleDesc, toast_values, toast_nulls); diff -ruN ../base/src/include/access/htup.h src/include/access/htup.h --- ../base/src/include/access/htup.h 2002-07-15 16:52:05.000000000 +0200 +++ src/include/access/htup.h 2002-07-16 19:58:01.000000000 +0200 @@ -70,8 +70,6 @@ */ typedef struct HeapTupleHeaderData { - Oid t_oid; /* OID of this tuple -- 4 bytes */ - TransactionId t_xmin; /* Xmin -- 4 bytes each */ TransactionId t_cid; /* Cmin, Cmax, Xvac */ TransactionId t_xmax; /* Xmax, Cmax */ @@ -84,7 +82,7 @@ uint8 t_hoff; /* sizeof header incl. bitmap, padding */ - /* ^ - 27 bytes - ^ */ + /* ^ - 23 bytes - ^ */ bits8 t_bits[1]; /* bitmap of NULLs -- VARIABLE LENGTH */ @@ -127,18 +125,19 @@ #ifdef DEBUG_TUPLE_ACCESS -#define HeapTupleHeaderExpectedLen(tup) \ +#define HeapTupleHeaderExpectedLen(tup, withoid) \ MAXALIGN(offsetof(HeapTupleHeaderData, t_bits) + \ (((tup)->t_infomask & HEAP_HASNULL) \ - ? BITMAPLEN((tup)->t_natts) : 0) \ + ? BITMAPLEN((tup)->t_natts) : 0) + \ + ((withoid) ? sizeof(Oid) : 0) \ ) -#define AssertHeapTupleHeaderHoffIsValid(tup) \ - AssertMacro((tup)->t_hoff == HeapTupleHeaderExpectedLen(tup)) +#define AssertHeapTupleHeaderHoffIsValid(tup, withoid) \ + AssertMacro((tup)->t_hoff == HeapTupleHeaderExpectedLen(tup, withoid)) #else -#define AssertHeapTupleHeaderHoffIsValid(tup) ((void)true) +#define AssertHeapTupleHeaderHoffIsValid(tup, withoid) ((void)true) #endif /* DEBUG_TUPLE_ACCESS */ @@ -147,14 +146,14 @@ #define HeapTupleHeaderGetOid(tup) \ ( \ - AssertHeapTupleHeaderHoffIsValid(tup), \ - (tup)->t_oid \ + AssertHeapTupleHeaderHoffIsValid(tup, true), \ + *((Oid *)((char *)(tup) + (tup)->t_hoff - sizeof(Oid))) \ ) #define HeapTupleHeaderSetOid(tup, oid) \ ( \ - AssertHeapTupleHeaderHoffIsValid(tup), \ - (tup)->t_oid = (oid) \ + AssertHeapTupleHeaderHoffIsValid(tup, true), \ + *((Oid *)((char *)(tup) + (tup)->t_hoff - sizeof(Oid))) = (oid) \ )