From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Manfred Koizar <mkoi-pg(at)aon(dot)at> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: Wrap access to Oid II |
Date: | 2002-07-12 03:01:32 |
Message-ID: | 200207120301.g6C31WP05381@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Manfred, would you make any appropriate adjustments to this patch as
discussed with Tom and resubmit? Thanks.
---------------------------------------------------------------------------
Manfred Koizar wrote:
> Revised version of the first in a series of patches leading to
> heap tuple headers withoid oid for tables created WITHOUT OIDS.
>
> Servus
> Manfred
>
> diff -ru ../base/src/backend/access/common/heaptuple.c src/backend/access/common/heaptuple.c
> --- ../base/src/backend/access/common/heaptuple.c 2002-06-21 02:12:13.000000000 +0200
> +++ src/backend/access/common/heaptuple.c 2002-07-04 16:23:04.000000000 +0200
> @@ -436,7 +436,7 @@
> result = PointerGetDatum(&(tup->t_self));
> break;
> case ObjectIdAttributeNumber:
> - result = ObjectIdGetDatum(tup->t_data->t_oid);
> + result = ObjectIdGetDatum(HeapTupleGetOid(tup));
> break;
> case MinTransactionIdAttributeNumber:
> result = TransactionIdGetDatum(HeapTupleHeaderGetXmin(tup->t_data));
> @@ -698,14 +698,18 @@
> * t_infomask
> */
> infomask = newTuple->t_data->t_infomask;
> - memmove((char *) &newTuple->t_data->t_oid, /* XXX */
> - (char *) &tuple->t_data->t_oid,
> - ((char *) &tuple->t_data->t_hoff -
> - (char *) &tuple->t_data->t_oid)); /* XXX */
> + /*
> + * copy t_xmin, t_cid, t_xmax, t_ctid, t_natts, t_infomask
> + */
> + memmove((char *) newTuple->t_data, /* XXX */
> + (char *) tuple->t_data,
> + offsetof(HeapTupleHeaderData, t_hoff)); /* XXX */
> newTuple->t_data->t_infomask = infomask;
> newTuple->t_data->t_natts = numberOfAttributes;
> newTuple->t_self = tuple->t_self;
> newTuple->t_tableOid = tuple->t_tableOid;
> + if (relation->rd_rel->relhasoids)
> + HeapTupleSetOid(newTuple, HeapTupleGetOid(tuple));
>
> return newTuple;
> }
> diff -ru ../base/src/backend/access/common/tupdesc.c src/backend/access/common/tupdesc.c
> --- ../base/src/backend/access/common/tupdesc.c 2002-06-21 02:12:13.000000000 +0200
> +++ src/backend/access/common/tupdesc.c 2002-07-04 00:26:37.000000000 +0200
> @@ -392,7 +392,7 @@
> */
> typeForm = (Form_pg_type) GETSTRUCT(tuple);
>
> - att->atttypid = tuple->t_data->t_oid;
> + att->atttypid = HeapTupleGetOid(tuple);
>
> /*
> * There are a couple of cases where we must override the information
> diff -ru ../base/src/backend/access/heap/heapam.c src/backend/access/heap/heapam.c
> --- ../base/src/backend/access/heap/heapam.c 2002-07-03 12:27:39.000000000 +0200
> +++ src/backend/access/heap/heapam.c 2002-07-04 00:26:37.000000000 +0200
> @@ -1116,10 +1116,10 @@
> * to support a persistent object store (objects need to contain
> * pointers to one another).
> */
> - if (!OidIsValid(tup->t_data->t_oid))
> - tup->t_data->t_oid = newoid();
> + if (!OidIsValid(HeapTupleGetOid(tup)))
> + HeapTupleSetOid(tup, newoid());
> else
> - CheckMaxObjectId(tup->t_data->t_oid);
> + CheckMaxObjectId(HeapTupleGetOid(tup));
> }
>
> HeapTupleHeaderSetXmin(tup->t_data, GetCurrentTransactionId());
> @@ -1166,7 +1166,10 @@
> rdata[0].len = SizeOfHeapInsert;
> rdata[0].next = &(rdata[1]);
>
> - xlhdr.t_oid = tup->t_data->t_oid;
> + if (relation->rd_rel->relhasoids)
> + xlhdr.t_oid = HeapTupleGetOid(tup);
> + else
> + xlhdr.t_oid = InvalidOid;
> xlhdr.t_natts = tup->t_data->t_natts;
> xlhdr.t_hoff = tup->t_data->t_hoff;
> xlhdr.mask = tup->t_data->t_infomask;
> @@ -1206,7 +1209,10 @@
> */
> CacheInvalidateHeapTuple(relation, tup);
>
> - return tup->t_data->t_oid;
> + if (!relation->rd_rel->relhasoids)
> + return InvalidOid;
> +
> + return HeapTupleGetOid(tup);
> }
>
> /*
> @@ -1499,7 +1505,8 @@
> }
>
> /* Fill in OID and transaction status data for newtup */
> - newtup->t_data->t_oid = oldtup.t_data->t_oid;
> + if (relation->rd_rel->relhasoids)
> + HeapTupleSetOid(newtup, HeapTupleGetOid(&oldtup));
> newtup->t_data->t_infomask &= ~(HEAP_XACT_MASK);
> newtup->t_data->t_infomask |= (HEAP_XMAX_INVALID | HEAP_UPDATED);
> HeapTupleHeaderSetXmin(newtup->t_data, GetCurrentTransactionId());
> @@ -1972,7 +1979,10 @@
> rdata[1].len = 0;
> rdata[1].next = &(rdata[2]);
>
> - xlhdr.hdr.t_oid = newtup->t_data->t_oid;
> + if (reln->rd_rel->relhasoids)
> + xlhdr.hdr.t_oid = HeapTupleGetOid(newtup);
> + else
> + xlhdr.hdr.t_oid = InvalidOid;
> xlhdr.hdr.t_natts = newtup->t_data->t_natts;
> xlhdr.hdr.t_hoff = newtup->t_data->t_hoff;
> xlhdr.hdr.mask = newtup->t_data->t_infomask;
> @@ -2198,7 +2208,6 @@
> newlen);
> newlen += offsetof(HeapTupleHeaderData, t_bits);
> htup = &tbuf.hdr;
> - htup->t_oid = xlhdr.t_oid;
> htup->t_natts = xlhdr.t_natts;
> htup->t_hoff = xlhdr.t_hoff;
> htup->t_infomask = HEAP_XMAX_INVALID | xlhdr.mask;
> @@ -2206,6 +2215,8 @@
> HeapTupleHeaderSetCmin(htup, FirstCommandId);
> HeapTupleHeaderSetXmaxInvalid(htup);
> HeapTupleHeaderSetCmax(htup, FirstCommandId);
> + if (reln->rd_rel->relhasoids)
> + HeapTupleHeaderSetOid(htup, xlhdr.t_oid);
>
> offnum = PageAddItem(page, (Item) htup, newlen, offnum,
> LP_USED | OverwritePageMode);
> @@ -2367,9 +2378,10 @@
> newlen);
> newlen += offsetof(HeapTupleHeaderData, t_bits);
> htup = &tbuf.hdr;
> - htup->t_oid = xlhdr.t_oid;
> htup->t_natts = xlhdr.t_natts;
> htup->t_hoff = xlhdr.t_hoff;
> + if (reln->rd_rel->relhasoids)
> + HeapTupleHeaderSetOid(htup, xlhdr.t_oid);
> if (move)
> {
> TransactionId xmax;
> diff -ru ../base/src/backend/bootstrap/bootstrap.c src/backend/bootstrap/bootstrap.c
> --- ../base/src/backend/bootstrap/bootstrap.c 2002-06-21 02:12:14.000000000 +0200
> +++ src/backend/bootstrap/bootstrap.c 2002-07-04 00:26:37.000000000 +0200
> @@ -495,7 +495,8 @@
> app = Typ;
> while ((tup = heap_getnext(scan, ForwardScanDirection)) != NULL)
> {
> - (*app)->am_oid = tup->t_data->t_oid;
> + AssertRelationHasOids(rel);
> + (*app)->am_oid = HeapTupleGetOid(tup);
> memcpy((char *) &(*app)->am_typ,
> (char *) GETSTRUCT(tup),
> sizeof((*app)->am_typ));
> @@ -679,7 +680,10 @@
> pfree(tupDesc); /* just free's tupDesc, not the attrtypes */
>
> if (objectid != (Oid) 0)
> - tuple->t_data->t_oid = objectid;
> + {
> + AssertRelationHasOids(boot_reldesc);
> + HeapTupleSetOid(tuple, objectid);
> + }
> simple_heap_insert(boot_reldesc, tuple);
> heap_freetuple(tuple);
> elog(DEBUG3, "row inserted");
> @@ -871,7 +875,8 @@
> app = Typ;
> while ((tup = heap_getnext(scan, ForwardScanDirection)) != NULL)
> {
> - (*app)->am_oid = tup->t_data->t_oid;
> + AssertRelationHasOids(rel);
> + (*app)->am_oid = HeapTupleGetOid(tup);
> memmove((char *) &(*app++)->am_typ,
> (char *) GETSTRUCT(tup),
> sizeof((*app)->am_typ));
> diff -ru ../base/src/backend/catalog/aclchk.c src/backend/catalog/aclchk.c
> --- ../base/src/backend/catalog/aclchk.c 2002-06-21 02:12:14.000000000 +0200
> +++ src/backend/catalog/aclchk.c 2002-07-04 00:26:37.000000000 +0200
> @@ -591,7 +591,8 @@
> elog(ERROR, "namespace \"%s\" not found", nspname);
> pg_namespace_tuple = (Form_pg_namespace) GETSTRUCT(tuple);
>
> - if (!pg_namespace_ownercheck(tuple->t_data->t_oid, GetUserId()))
> + AssertRelationHasOids(relation);
> + if (!pg_namespace_ownercheck(HeapTupleGetOid(tuple), GetUserId()))
> aclcheck_error(ACLCHECK_NOT_OWNER, nspname);
>
> /*
> diff -ru ../base/src/backend/catalog/heap.c src/backend/catalog/heap.c
> --- ../base/src/backend/catalog/heap.c 2002-06-21 02:12:14.000000000 +0200
> +++ src/backend/catalog/heap.c 2002-07-04 00:26:37.000000000 +0200
> @@ -583,7 +583,7 @@
> (void *) new_rel_reltup);
>
> /* force tuple to have the desired OID */
> - tup->t_data->t_oid = new_rel_oid;
> + HeapTupleSetOid(tup, new_rel_oid);
>
> /*
> * finally insert the new tuple and free it.
> @@ -1109,7 +1109,8 @@
> * the type of the relation we are deleteing then we have to disallow
> * the deletion. should talk to stonebraker about this. -cim 6/19/90
> */
> - typoid = tup->t_data->t_oid;
> + AssertRelationHasOids(pg_type_desc);
> + typoid = HeapTupleGetOid(tup);
>
> pg_attribute_desc = heap_openr(AttributeRelationName, RowExclusiveLock);
>
> diff -ru ../base/src/backend/catalog/index.c src/backend/catalog/index.c
> --- ../base/src/backend/catalog/index.c 2002-06-21 02:12:14.000000000 +0200
> +++ src/backend/catalog/index.c 2002-07-04 00:26:37.000000000 +0200
> @@ -326,7 +326,7 @@
> * the new tuple must have the oid already chosen for the index.
> * sure would be embarrassing to do this sort of thing in polite company.
> */
> - tuple->t_data->t_oid = RelationGetRelid(indexRelation);
> + HeapTupleSetOid(tuple, RelationGetRelid(indexRelation));
> simple_heap_insert(pg_class, tuple);
>
> /*
> diff -ru ../base/src/backend/catalog/namespace.c src/backend/catalog/namespace.c
> --- ../base/src/backend/catalog/namespace.c 2002-06-21 02:12:15.000000000 +0200
> +++ src/backend/catalog/namespace.c 2002-07-04 00:26:38.000000000 +0200
> @@ -584,7 +584,7 @@
> continue; /* keep previous result */
> /* replace previous result */
> prevResult->pathpos = pathpos;
> - prevResult->oid = proctup->t_data->t_oid;
> + prevResult->oid = HeapTupleGetOid(proctup);
> continue; /* args are same, of course */
> }
> }
> @@ -597,7 +597,7 @@
> palloc(sizeof(struct _FuncCandidateList) - sizeof(Oid)
> + nargs * sizeof(Oid));
> newResult->pathpos = pathpos;
> - newResult->oid = proctup->t_data->t_oid;
> + newResult->oid = HeapTupleGetOid(proctup);
> newResult->nargs = nargs;
> memcpy(newResult->args, procform->proargtypes, nargs * sizeof(Oid));
>
> @@ -831,7 +831,7 @@
> continue; /* keep previous result */
> /* replace previous result */
> prevResult->pathpos = pathpos;
> - prevResult->oid = opertup->t_data->t_oid;
> + prevResult->oid = HeapTupleGetOid(opertup);
> continue; /* args are same, of course */
> }
> }
> @@ -843,7 +843,7 @@
> newResult = (FuncCandidateList)
> palloc(sizeof(struct _FuncCandidateList) + sizeof(Oid));
> newResult->pathpos = pathpos;
> - newResult->oid = opertup->t_data->t_oid;
> + newResult->oid = HeapTupleGetOid(opertup);
> newResult->nargs = 2;
> newResult->args[0] = operform->oprleft;
> newResult->args[1] = operform->oprright;
> @@ -1007,7 +1007,7 @@
> /* replace previous result */
> prevResult->opcname_tmp = NameStr(opcform->opcname);
> prevResult->pathpos = pathpos;
> - prevResult->oid = opctup->t_data->t_oid;
> + prevResult->oid = HeapTupleGetOid(opctup);
> prevResult->opcintype = opcform->opcintype;
> prevResult->opcdefault = opcform->opcdefault;
> prevResult->opckeytype = opcform->opckeytype;
> @@ -1022,7 +1022,7 @@
> palloc(sizeof(struct _OpclassCandidateList));
> newResult->opcname_tmp = NameStr(opcform->opcname);
> newResult->pathpos = pathpos;
> - newResult->oid = opctup->t_data->t_oid;
> + newResult->oid = HeapTupleGetOid(opctup);
> newResult->opcintype = opcform->opcintype;
> newResult->opcdefault = opcform->opcdefault;
> newResult->opckeytype = opcform->opckeytype;
> @@ -1597,7 +1597,7 @@
> case RELKIND_RELATION:
> case RELKIND_SEQUENCE:
> case RELKIND_VIEW:
> - tempRelList = lconsi(tuple->t_data->t_oid, tempRelList);
> + tempRelList = lconsi(HeapTupleGetOid(tuple), tempRelList);
> break;
> default:
> break;
> diff -ru ../base/src/backend/catalog/pg_operator.c src/backend/catalog/pg_operator.c
> --- ../base/src/backend/catalog/pg_operator.c 2002-06-21 02:12:15.000000000 +0200
> +++ src/backend/catalog/pg_operator.c 2002-07-04 00:26:38.000000000 +0200
> @@ -141,7 +141,7 @@
> {
> RegProcedure oprcode = ((Form_pg_operator) GETSTRUCT(tup))->oprcode;
>
> - operatorObjectId = tup->t_data->t_oid;
> + operatorObjectId = HeapTupleGetOid(tup);
> *defined = RegProcedureIsValid(oprcode);
> ReleaseSysCache(tup);
> }
> diff -ru ../base/src/backend/catalog/pg_proc.c src/backend/catalog/pg_proc.c
> --- ../base/src/backend/catalog/pg_proc.c 2002-06-21 02:12:15.000000000 +0200
> +++ src/backend/catalog/pg_proc.c 2002-07-04 00:26:38.000000000 +0200
> @@ -249,7 +249,8 @@
> CatalogCloseIndices(Num_pg_proc_indices, idescs);
> }
>
> - retval = tup->t_data->t_oid;
> + AssertRelationHasOids(rel);
> + retval = HeapTupleGetOid(tup);
> heap_freetuple(tup);
>
> heap_close(rel, RowExclusiveLock);
> diff -ru ../base/src/backend/catalog/pg_type.c src/backend/catalog/pg_type.c
> --- ../base/src/backend/catalog/pg_type.c 2002-06-21 02:12:15.000000000 +0200
> +++ src/backend/catalog/pg_type.c 2002-07-04 00:26:38.000000000 +0200
> @@ -272,7 +272,8 @@
>
> simple_heap_update(pg_type_desc, &tup->t_self, tup);
>
> - typeObjectId = tup->t_data->t_oid;
> + AssertRelationHasOids(pg_type_desc);
> + typeObjectId = HeapTupleGetOid(tup);
> }
> else
> {
> @@ -283,7 +284,8 @@
> nulls);
>
> /* preassign tuple Oid, if one was given */
> - tup->t_data->t_oid = assignedTypeOid;
> + AssertRelationHasOids(pg_type_desc);
> + HeapTupleSetOid(tup, assignedTypeOid);
>
> typeObjectId = simple_heap_insert(pg_type_desc, tup);
> }
> diff -ru ../base/src/backend/commands/comment.c src/backend/commands/comment.c
> --- ../base/src/backend/commands/comment.c 2002-06-21 02:12:15.000000000 +0200
> +++ src/backend/commands/comment.c 2002-07-04 00:26:38.000000000 +0200
> @@ -424,7 +424,8 @@
>
> if (!HeapTupleIsValid(dbtuple))
> elog(ERROR, "database \"%s\" does not exist", database);
> - oid = dbtuple->t_data->t_oid;
> + AssertRelationHasOids(pg_database);
> + oid = HeapTupleGetOid(dbtuple);
>
> /* Allow if the user matches the database dba or is a superuser */
>
> @@ -470,7 +471,8 @@
> elog(ERROR, "CommentSchema: Schema \"%s\" could not be found",
> namespace);
>
> - oid = tp->t_data->t_oid;
> + /* no Relation here to Assert(...->relhasoids); */
> + oid = HeapTupleGetOid(tp);
>
> /* Check object security */
> if (!pg_namespace_ownercheck(oid, GetUserId()))
> @@ -541,7 +543,8 @@
> if (HeapTupleIsValid(tuple))
> {
> reloid = ((Form_pg_rewrite) GETSTRUCT(tuple))->ev_class;
> - ruleoid = tuple->t_data->t_oid;
> + AssertRelationHasOids(RewriteRelation);
> + ruleoid = HeapTupleGetOid(tuple);
> }
> else
> {
> @@ -581,7 +584,8 @@
> if (!HeapTupleIsValid(tuple))
> elog(ERROR, "rule \"%s\" does not exist", rulename);
> Assert(reloid == ((Form_pg_rewrite) GETSTRUCT(tuple))->ev_class);
> - ruleoid = tuple->t_data->t_oid;
> + AssertRelationHasOids(relation);
> + ruleoid = HeapTupleGetOid(tuple);
> ReleaseSysCache(tuple);
> }
>
> @@ -794,7 +798,8 @@
> elog(ERROR, "trigger \"%s\" for relation \"%s\" does not exist",
> trigname, RelationGetRelationName(relation));
>
> - oid = triggertuple->t_data->t_oid;
> + AssertRelationHasOids(pg_trigger);
> + oid = HeapTupleGetOid(triggertuple);
>
> systable_endscan(scan);
>
> diff -ru ../base/src/backend/commands/copy.c src/backend/commands/copy.c
> --- ../base/src/backend/commands/copy.c 2002-06-21 02:12:15.000000000 +0200
> +++ src/backend/commands/copy.c 2002-07-04 00:26:38.000000000 +0200
> @@ -575,9 +575,13 @@
> /* Send OID if wanted --- note fld_count doesn't include it */
> if (oids)
> {
> + Oid oid;
> +
> + AssertRelationHasOids(rel);
> + oid = HeapTupleGetOid(tuple);
> fld_size = sizeof(Oid);
> CopySendData(&fld_size, sizeof(int16), fp);
> - CopySendData(&tuple->t_data->t_oid, sizeof(Oid), fp);
> + CopySendData(&oid, sizeof(Oid), fp);
> }
> }
> else
> @@ -585,8 +589,9 @@
> /* Text format has no per-tuple header, but send OID if wanted */
> if (oids)
> {
> + AssertRelationHasOids(rel);
> string = DatumGetCString(DirectFunctionCall1(oidout,
> - ObjectIdGetDatum(tuple->t_data->t_oid)));
> + ObjectIdGetDatum(HeapTupleGetOid(tuple))));
> CopySendString(string, fp);
> pfree(string);
> need_delim = true;
> @@ -977,7 +982,7 @@
> tuple = heap_formtuple(tupDesc, values, nulls);
>
> if (oids && file_has_oids)
> - tuple->t_data->t_oid = loaded_oid;
> + HeapTupleSetOid(tuple, loaded_oid);
>
> skip_tuple = false;
>
> diff -ru ../base/src/backend/commands/dbcommands.c src/backend/commands/dbcommands.c
> --- ../base/src/backend/commands/dbcommands.c 2002-06-21 02:12:15.000000000 +0200
> +++ src/backend/commands/dbcommands.c 2002-07-04 00:26:38.000000000 +0200
> @@ -341,7 +341,8 @@
>
> tuple = heap_formtuple(pg_database_dsc, new_record, new_record_nulls);
>
> - tuple->t_data->t_oid = dboid; /* override heap_insert's OID
> + AssertRelationHasOids(pg_database_rel);
> + HeapTupleSetOid(tuple, dboid); /* override heap_insert's OID
> * selection */
>
> simple_heap_insert(pg_database_rel, tuple);
> @@ -611,7 +612,10 @@
>
> /* oid of the database */
> if (dbIdP)
> - *dbIdP = tuple->t_data->t_oid;
> + {
> + AssertRelationHasOids(relation);
> + *dbIdP = HeapTupleGetOid(tuple);
> + }
> /* sysid of the owner */
> if (ownerIdP)
> *ownerIdP = dbform->datdba;
> diff -ru ../base/src/backend/commands/functioncmds.c src/backend/commands/functioncmds.c
> --- ../base/src/backend/commands/functioncmds.c 2002-06-21 02:12:15.000000000 +0200
> +++ src/backend/commands/functioncmds.c 2002-07-04 00:26:38.000000000 +0200
> @@ -439,7 +439,8 @@
> if (!HeapTupleIsValid(languageTuple))
> elog(ERROR, "language \"%s\" does not exist", languageName);
>
> - languageOid = languageTuple->t_data->t_oid;
> + /* no Relation here to Assert(...->relhasoids) */
> + languageOid = HeapTupleGetOid(languageTuple);
> languageStruct = (Form_pg_language) GETSTRUCT(languageTuple);
>
> if (languageStruct->lanpltrusted)
> diff -ru ../base/src/backend/commands/indexcmds.c src/backend/commands/indexcmds.c
> --- ../base/src/backend/commands/indexcmds.c 2002-07-01 19:50:36.000000000 +0200
> +++ src/backend/commands/indexcmds.c 2002-07-04 00:26:38.000000000 +0200
> @@ -139,7 +139,8 @@
> if (!HeapTupleIsValid(tuple))
> elog(ERROR, "DefineIndex: access method \"%s\" not found",
> accessMethodName);
> - accessMethodId = tuple->t_data->t_oid;
> + /* AssertRelationHasOids(rel); rel is already closed */
> + accessMethodId = HeapTupleGetOid(tuple);
> accessMethodForm = (Form_pg_am) GETSTRUCT(tuple);
>
> if (unique && !accessMethodForm->amcanunique)
> @@ -494,7 +495,8 @@
> * Verify that the index operator class accepts this
> * datatype. Note we will accept binary compatibility.
> */
> - opClassId = tuple->t_data->t_oid;
> + /* no Relation here to AssertRelationHasOids(relation); */
> + opClassId = HeapTupleGetOid(tuple);
> opInputType = ((Form_pg_opclass) GETSTRUCT(tuple))->opcintype;
>
> if (!IsBinaryCompatible(attrType, opInputType))
> @@ -754,7 +756,8 @@
> relids = repalloc(relids, sizeof(Oid) * relalc);
> }
> MemoryContextSwitchTo(old);
> - relids[relcnt] = tuple->t_data->t_oid;
> + AssertRelationHasOids(relationRelation);
> + relids[relcnt] = HeapTupleGetOid(tuple);
> relcnt++;
> }
> }
> diff -ru ../base/src/backend/commands/tablecmds.c src/backend/commands/tablecmds.c
> --- ../base/src/backend/commands/tablecmds.c 2002-07-01 19:50:36.000000000 +0200
> +++ src/backend/commands/tablecmds.c 2002-07-04 00:26:39.000000000 +0200
> @@ -1655,7 +1655,7 @@
>
> attribute->attrelid = myrelid;
> namestrcpy(&(attribute->attname), colDef->colname);
> - attribute->atttypid = typeTuple->t_data->t_oid;
> + attribute->atttypid = HeapTupleGetOid(typeTuple);
> attribute->attstattarget = DEFAULT_ATTSTATTARGET;
> attribute->attlen = tform->typlen;
> attribute->attcacheoff = -1;
> diff -ru ../base/src/backend/commands/trigger.c src/backend/commands/trigger.c
> --- ../base/src/backend/commands/trigger.c 2002-06-21 02:12:15.000000000 +0200
> +++ src/backend/commands/trigger.c 2002-07-04 00:26:39.000000000 +0200
> @@ -364,7 +364,8 @@
> if (namestrcmp(&(pg_trigger->tgname), trigname) == 0)
> {
> /* Delete any comments associated with this trigger */
> - DeleteComments(tuple->t_data->t_oid, RelationGetRelid(tgrel));
> + AssertRelationHasOids(tgrel);
> + DeleteComments(HeapTupleGetOid(tuple), RelationGetRelid(tgrel));
>
> simple_heap_delete(tgrel, &tuple->t_self);
> found++;
> @@ -430,7 +431,8 @@
> while (HeapTupleIsValid(tup = systable_getnext(tgscan)))
> {
> /* Delete any comments associated with this trigger */
> - DeleteComments(tup->t_data->t_oid, RelationGetRelid(tgrel));
> + AssertRelationHasOids(tgrel);
> + DeleteComments(HeapTupleGetOid(tup), RelationGetRelid(tgrel));
>
> simple_heap_delete(tgrel, &tup->t_self);
>
> @@ -667,7 +669,8 @@
> RelationGetRelationName(relation));
> build = &(triggers[found]);
>
> - build->tgoid = htup->t_data->t_oid;
> + AssertRelationHasOids(tgrel);
> + build->tgoid = HeapTupleGetOid(htup);
> build->tgname = MemoryContextStrdup(CacheMemoryContext,
> DatumGetCString(DirectFunctionCall1(nameout,
> NameGetDatum(&pg_trigger->tgname))));
> @@ -1928,7 +1931,8 @@
> elog(ERROR, "Constraint '%s' is not deferrable",
> cname);
>
> - constr_oid = htup->t_data->t_oid;
> + AssertRelationHasOids(tgrel);
> + constr_oid = HeapTupleGetOid(htup);
> loid = lappendi(loid, constr_oid);
> found = true;
> }
> diff -ru ../base/src/backend/commands/typecmds.c src/backend/commands/typecmds.c
> --- ../base/src/backend/commands/typecmds.c 2002-07-01 19:50:36.000000000 +0200
> +++ src/backend/commands/typecmds.c 2002-07-04 00:26:39.000000000 +0200
> @@ -474,7 +474,7 @@
> * Note: Name is strictly for error message
> */
> expr = cookDefault(pstate, colDef->raw_expr,
> - typeTup->t_data->t_oid,
> + HeapTupleGetOid(typeTup),
> stmt->typename->typmod,
> domainName);
> /*
> @@ -551,7 +551,7 @@
> receiveProcedure, /* receive procedure */
> sendProcedure, /* send procedure */
> basetypelem, /* element type ID */
> - typeTup->t_data->t_oid, /* base type ID */
> + HeapTupleGetOid(typeTup), /* base type ID */
> defaultValue, /* default type value (text) */
> defaultValueBin, /* default type value (binary) */
> byValue, /* passed by value */
> diff -ru ../base/src/backend/commands/vacuum.c src/backend/commands/vacuum.c
> --- ../base/src/backend/commands/vacuum.c 2002-06-21 02:12:15.000000000 +0200
> +++ src/backend/commands/vacuum.c 2002-07-04 00:26:39.000000000 +0200
> @@ -392,7 +392,8 @@
> {
> /* Make a relation list entry for this guy */
> oldcontext = MemoryContextSwitchTo(vac_context);
> - vrl = lappendi(vrl, tuple->t_data->t_oid);
> + AssertRelationHasOids(pgclass);
> + vrl = lappendi(vrl, HeapTupleGetOid(tuple));
> MemoryContextSwitchTo(oldcontext);
> }
>
> @@ -1172,8 +1173,8 @@
> /*
> * Other checks...
> */
> - if (!OidIsValid(tuple.t_data->t_oid) &&
> - onerel->rd_rel->relhasoids)
> + if (onerel->rd_rel->relhasoids &&
> + !OidIsValid(HeapTupleGetOid(&tuple)))
> elog(WARNING, "Rel %s: TID %u/%u: OID IS INVALID. TUPGONE %d.",
> relname, blkno, offnum, (int) tupgone);
>
> diff -ru ../base/src/backend/commands/vacuumlazy.c src/backend/commands/vacuumlazy.c
> --- ../base/src/backend/commands/vacuumlazy.c 2002-06-21 02:12:15.000000000 +0200
> +++ src/backend/commands/vacuumlazy.c 2002-07-04 00:26:39.000000000 +0200
> @@ -368,8 +368,8 @@
> /*
> * Other checks...
> */
> - if (!OidIsValid(tuple.t_data->t_oid) &&
> - onerel->rd_rel->relhasoids)
> + if (onerel->rd_rel->relhasoids &&
> + !OidIsValid(HeapTupleGetOid(&tuple)))
> elog(WARNING, "Rel %s: TID %u/%u: OID IS INVALID. TUPGONE %d.",
> relname, blkno, offnum, (int) tupgone);
>
> diff -ru ../base/src/backend/executor/spi.c src/backend/executor/spi.c
> --- ../base/src/backend/executor/spi.c 2002-06-21 02:12:16.000000000 +0200
> +++ src/backend/executor/spi.c 2002-07-04 16:24:24.000000000 +0200
> @@ -435,11 +435,15 @@
> {
> mtuple = heap_formtuple(rel->rd_att, v, n);
> infomask = mtuple->t_data->t_infomask;
> - memmove(&(mtuple->t_data->t_oid), &(tuple->t_data->t_oid),
> - ((char *) &(tuple->t_data->t_hoff) -
> - (char *) &(tuple->t_data->t_oid)));
> + /*
> + * copy t_xmin, t_cid, t_xmax, t_ctid, t_natts, t_infomask
> + */
> + memmove((char *)mtuple->t_data, (char *)tuple->t_data,
> + offsetof(HeapTupleHeaderData, t_hoff));
> mtuple->t_data->t_infomask = infomask;
> mtuple->t_data->t_natts = numberOfAttributes;
> + if (rel->rd_rel->relhasoids)
> + HeapTupleSetOid(mtuple, HeapTupleGetOid(tuple));
> }
> else
> {
> diff -ru ../base/src/backend/optimizer/util/clauses.c src/backend/optimizer/util/clauses.c
> --- ../base/src/backend/optimizer/util/clauses.c 2002-06-21 02:12:18.000000000 +0200
> +++ src/backend/optimizer/util/clauses.c 2002-07-04 00:26:39.000000000 +0200
> @@ -1066,7 +1066,7 @@
>
> commuTup = (Form_pg_operator) GETSTRUCT(optup);
>
> - commu = makeOper(optup->t_data->t_oid,
> + commu = makeOper(HeapTupleGetOid(optup),
> commuTup->oprcode,
> commuTup->oprresult,
> ((Oper *) clause->oper)->opretset);
> diff -ru ../base/src/backend/parser/parse_coerce.c src/backend/parser/parse_coerce.c
> --- ../base/src/backend/parser/parse_coerce.c 2002-06-21 02:12:18.000000000 +0200
> +++ src/backend/parser/parse_coerce.c 2002-07-04 00:26:39.000000000 +0200
> @@ -770,7 +770,8 @@
> if (isExplicit || pform->proimplicit)
> {
> /* Okay to use it */
> - funcid = ftup->t_data->t_oid;
> + /* Assert(ftup has oid) */
> + funcid = HeapTupleGetOid(ftup);
> }
> }
> ReleaseSysCache(ftup);
> diff -ru ../base/src/backend/parser/parse_oper.c src/backend/parser/parse_oper.c
> --- ../base/src/backend/parser/parse_oper.c 2002-06-21 02:12:19.000000000 +0200
> +++ src/backend/parser/parse_oper.c 2002-07-04 00:26:39.000000000 +0200
> @@ -150,7 +150,8 @@
> Oid
> oprid(Operator op)
> {
> - return op->t_data->t_oid;
> + /* Assert(op has oid) */
> + return HeapTupleGetOid(op);
> }
>
> /* given operator tuple, return the underlying function's OID */
> diff -ru ../base/src/backend/parser/parse_type.c src/backend/parser/parse_type.c
> --- ../base/src/backend/parser/parse_type.c 2002-06-21 02:12:19.000000000 +0200
> +++ src/backend/parser/parse_type.c 2002-07-04 00:26:39.000000000 +0200
> @@ -283,7 +283,8 @@
> {
> if (tp == NULL)
> elog(ERROR, "typeTypeId() called with NULL type struct");
> - return tp->t_data->t_oid;
> + /* Assert(tp has oid); */
> + return HeapTupleGetOid(tp);
> }
>
> /* given type (as type struct), return the length of type */
> diff -ru ../base/src/backend/postmaster/pgstat.c src/backend/postmaster/pgstat.c
> --- ../base/src/backend/postmaster/pgstat.c 2002-05-21 11:54:17.000000000 +0200
> +++ src/backend/postmaster/pgstat.c 2002-07-04 00:26:39.000000000 +0200
> @@ -628,7 +628,8 @@
> dbidlist = (Oid *) repalloc((char *) dbidlist,
> sizeof(Oid) * dbidalloc);
> }
> - dbidlist[dbidused++] = dbtup->t_data->t_oid;
> + AssertRelationHasOids(dbrel);
> + dbidlist[dbidused++] = HeapTupleGetOid(dbtup);
> }
> heap_endscan(dbscan);
> heap_close(dbrel, AccessShareLock);
> diff -ru ../base/src/backend/rewrite/rewriteRemove.c src/backend/rewrite/rewriteRemove.c
> --- ../base/src/backend/rewrite/rewriteRemove.c 2002-06-21 02:12:20.000000000 +0200
> +++ src/backend/rewrite/rewriteRemove.c 2002-07-04 00:26:39.000000000 +0200
> @@ -67,7 +67,8 @@
> * Save the OID of the rule (i.e. the tuple's OID) and the event
> * relation's OID
> */
> - ruleId = tuple->t_data->t_oid;
> + AssertRelationHasOids(RewriteRelation);
> + ruleId = HeapTupleGetOid(tuple);
> eventRelationOid = ((Form_pg_rewrite) GETSTRUCT(tuple))->ev_class;
> Assert(eventRelationOid == owningRel);
>
> @@ -157,7 +158,8 @@
> while (HeapTupleIsValid(tuple = systable_getnext(scanDesc)))
> {
> /* Delete any comments associated with this rule */
> - DeleteComments(tuple->t_data->t_oid, RelationGetRelid(RewriteRelation));
> + AssertRelationHasOids(RewriteRelation);
> + DeleteComments(HeapTupleGetOid(tuple), RelationGetRelid(RewriteRelation));
>
> simple_heap_delete(RewriteRelation, &tuple->t_self);
> }
> diff -ru ../base/src/backend/utils/adt/regproc.c src/backend/utils/adt/regproc.c
> --- ../base/src/backend/utils/adt/regproc.c 2002-06-21 02:12:22.000000000 +0200
> +++ src/backend/utils/adt/regproc.c 2002-07-04 00:26:39.000000000 +0200
> @@ -110,7 +110,8 @@
>
> while (HeapTupleIsValid(tuple = systable_getnext(sysscan)))
> {
> - result = (RegProcedure) tuple->t_data->t_oid;
> + AssertRelationHasOids(hdesc);
> + result = (RegProcedure) HeapTupleGetOid(tuple);
> if (++matches > 1)
> break;
> }
> @@ -414,7 +415,8 @@
>
> while (HeapTupleIsValid(tuple = systable_getnext(sysscan)))
> {
> - result = tuple->t_data->t_oid;
> + AssertRelationHasOids(hdesc);
> + result = HeapTupleGetOid(tuple);
> if (++matches > 1)
> break;
> }
> @@ -731,7 +733,10 @@
> SnapshotNow, 1, skey);
>
> if (HeapTupleIsValid(tuple = systable_getnext(sysscan)))
> - result = tuple->t_data->t_oid;
> + {
> + AssertRelationHasOids(hdesc);
> + result = HeapTupleGetOid(tuple);
> + }
> else
> elog(ERROR, "No class with name %s", class_name_or_oid);
>
> @@ -884,7 +889,10 @@
> SnapshotNow, 1, skey);
>
> if (HeapTupleIsValid(tuple = systable_getnext(sysscan)))
> - result = tuple->t_data->t_oid;
> + {
> + AssertRelationHasOids(hdesc);
> + result = HeapTupleGetOid(tuple);
> + }
> else
> elog(ERROR, "No type with name %s", typ_name_or_oid);
>
> diff -ru ../base/src/backend/utils/adt/sets.c src/backend/utils/adt/sets.c
> --- ../base/src/backend/utils/adt/sets.c 2002-06-21 02:12:22.000000000 +0200
> +++ src/backend/utils/adt/sets.c 2002-07-04 00:26:39.000000000 +0200
> @@ -120,7 +120,8 @@
>
> simple_heap_update(procrel, &newtup->t_self, newtup);
>
> - setoid = newtup->t_data->t_oid;
> + AssertRelationHasOids(procrel);
> + setoid = HeapTupleGetOid(newtup);
>
> if (RelationGetForm(procrel)->relhasindex)
> {
> diff -ru ../base/src/backend/utils/cache/catcache.c src/backend/utils/cache/catcache.c
> --- ../base/src/backend/utils/cache/catcache.c 2002-06-21 02:12:22.000000000 +0200
> +++ src/backend/utils/cache/catcache.c 2002-07-04 00:26:39.000000000 +0200
> @@ -218,7 +218,7 @@
> case 4:
> cur_skey[3].sk_argument =
> (cache->cc_key[3] == ObjectIdAttributeNumber)
> - ? ObjectIdGetDatum(tuple->t_data->t_oid)
> + ? ObjectIdGetDatum(HeapTupleGetOid(tuple))
> : fastgetattr(tuple,
> cache->cc_key[3],
> cache->cc_tupdesc,
> @@ -228,7 +228,7 @@
> case 3:
> cur_skey[2].sk_argument =
> (cache->cc_key[2] == ObjectIdAttributeNumber)
> - ? ObjectIdGetDatum(tuple->t_data->t_oid)
> + ? ObjectIdGetDatum(HeapTupleGetOid(tuple))
> : fastgetattr(tuple,
> cache->cc_key[2],
> cache->cc_tupdesc,
> @@ -238,7 +238,7 @@
> case 2:
> cur_skey[1].sk_argument =
> (cache->cc_key[1] == ObjectIdAttributeNumber)
> - ? ObjectIdGetDatum(tuple->t_data->t_oid)
> + ? ObjectIdGetDatum(HeapTupleGetOid(tuple))
> : fastgetattr(tuple,
> cache->cc_key[1],
> cache->cc_tupdesc,
> @@ -248,7 +248,7 @@
> case 1:
> cur_skey[0].sk_argument =
> (cache->cc_key[0] == ObjectIdAttributeNumber)
> - ? ObjectIdGetDatum(tuple->t_data->t_oid)
> + ? ObjectIdGetDatum(HeapTupleGetOid(tuple))
> : fastgetattr(tuple,
> cache->cc_key[0],
> cache->cc_tupdesc,
> @@ -572,7 +572,7 @@
> if (isCommit)
> elog(WARNING, "Cache reference leak: cache %s (%d), tuple %u has count %d",
> ct->my_cache->cc_relname, ct->my_cache->id,
> - ct->tuple.t_data->t_oid,
> + HeapTupleGetOid(&ct->tuple),
> ct->refcount);
> ct->refcount = 0;
> }
> @@ -717,7 +717,7 @@
> continue;
>
> if (cache->cc_reloidattr == ObjectIdAttributeNumber)
> - tupRelid = ct->tuple.t_data->t_oid;
> + tupRelid = HeapTupleGetOid(&ct->tuple);
> else
> {
> bool isNull;
> @@ -1685,7 +1685,7 @@
> }
>
> ntp = heap_formtuple(tupDesc, values, nulls);
> - ntp->t_data->t_oid = tupOid;
> + HeapTupleSetOid(ntp, tupOid);
>
> pfree(values);
> pfree(nulls);
> diff -ru ../base/src/backend/utils/cache/inval.c src/backend/utils/cache/inval.c
> --- ../base/src/backend/utils/cache/inval.c 2002-06-21 02:12:22.000000000 +0200
> +++ src/backend/utils/cache/inval.c 2002-07-04 00:26:39.000000000 +0200
> @@ -525,7 +525,10 @@
> tupleRelId = RelationGetRelid(relation);
>
> if (tupleRelId == RelOid_pg_class)
> - relationId = tuple->t_data->t_oid;
> + {
> + AssertRelationHasOids(relation);
> + relationId = HeapTupleGetOid(tuple);
> + }
> else if (tupleRelId == RelOid_pg_attribute)
> relationId = ((Form_pg_attribute) GETSTRUCT(tuple))->attrelid;
> else
> diff -ru ../base/src/backend/utils/cache/relcache.c src/backend/utils/cache/relcache.c
> --- ../base/src/backend/utils/cache/relcache.c 2002-06-21 02:12:23.000000000 +0200
> +++ src/backend/utils/cache/relcache.c 2002-07-04 00:26:39.000000000 +0200
> @@ -701,7 +701,8 @@
> rule = (RewriteRule *) MemoryContextAlloc(rulescxt,
> sizeof(RewriteRule));
>
> - rule->ruleId = rewrite_tuple->t_data->t_oid;
> + AssertRelationHasOids(rewrite_desc);
> + rule->ruleId = HeapTupleGetOid(rewrite_tuple);
>
> rule->event = rewrite_form->ev_type - '0';
> rule->attrno = rewrite_form->ev_attr;
> @@ -839,7 +840,8 @@
> /*
> * get information from the pg_class_tuple
> */
> - relid = pg_class_tuple->t_data->t_oid;
> + /* Assert(pg_class_tuple has oid); */
> + relid = HeapTupleGetOid(pg_class_tuple);
> relp = (Form_pg_class) GETSTRUCT(pg_class_tuple);
>
> /*
> diff -ru ../base/src/backend/utils/cache/syscache.c src/backend/utils/cache/syscache.c
> --- ../base/src/backend/utils/cache/syscache.c 2002-06-21 02:12:23.000000000 +0200
> +++ src/backend/utils/cache/syscache.c 2002-07-04 00:26:39.000000000 +0200
> @@ -574,7 +574,8 @@
> tuple = SearchSysCache(cacheId, key1, key2, key3, key4);
> if (!HeapTupleIsValid(tuple))
> return InvalidOid;
> - result = tuple->t_data->t_oid;
> + /* Assert(tuple has oid); */
> + result = HeapTupleGetOid(tuple);
> ReleaseSysCache(tuple);
> return result;
> }
> diff -ru ../base/src/backend/utils/init/postinit.c src/backend/utils/init/postinit.c
> --- ../base/src/backend/utils/init/postinit.c 2002-06-21 02:12:23.000000000 +0200
> +++ src/backend/utils/init/postinit.c 2002-07-04 00:26:40.000000000 +0200
> @@ -98,8 +98,9 @@
> pgdbscan = heap_beginscan(pgdbrel, SnapshotNow, 1, &key);
>
> tup = heap_getnext(pgdbscan, ForwardScanDirection);
> + AssertRelationHasOids(pgdbrel);
> if (!HeapTupleIsValid(tup) ||
> - tup->t_data->t_oid != MyDatabaseId)
> + HeapTupleGetOid(tup) != MyDatabaseId)
> {
> /* OOPS */
> heap_close(pgdbrel, AccessShareLock);
> diff -ru ../base/src/backend/utils/misc/database.c src/backend/utils/misc/database.c
> --- ../base/src/backend/utils/misc/database.c 2002-06-21 02:12:23.000000000 +0200
> +++ src/backend/utils/misc/database.c 2002-07-04 00:26:40.000000000 +0200
> @@ -220,7 +220,8 @@
> if (strcmp(name, NameStr(tup_db->datname)) == 0)
> {
> /* Found it; extract the OID and the database path. */
> - *db_id = tup.t_data->t_oid;
> + /* Assert(&tup has oid); */
> + *db_id = HeapTupleGetOid(&tup);
> pathlen = VARSIZE(&(tup_db->datpath)) - VARHDRSZ;
> if (pathlen < 0)
> pathlen = 0; /* pure paranoia */
> diff -ru ../base/src/include/access/htup.h src/include/access/htup.h
> --- ../base/src/include/access/htup.h 2002-07-03 12:27:42.000000000 +0200
> +++ src/include/access/htup.h 2002-07-04 18:05:04.000000000 +0200
> @@ -123,10 +123,41 @@
>
> #define HEAP_XACT_MASK 0xFFF0 /* visibility-related bits */
>
> +/* paranoid checking */
> +
> +#ifdef DEBUG_TUPLE_ACCESS
> +
> +#define HeapTupleHeaderExpectedLen(tup) \
> + MAXALIGN(offsetof(HeapTupleHeaderData, t_bits) + \
> + (((tup)->t_infomask & HEAP_HASNULL) \
> + ? BITMAPLEN((tup)->t_natts) : 0) \
> + )
> +
> +#define AssertHeapTupleHeaderHoffIsValid(tup) \
> + AssertMacro((tup)->t_hoff == HeapTupleHeaderExpectedLen(tup))
> +
> +#else
> +
> +#define AssertHeapTupleHeaderHoffIsValid(tup) ((void)true)
> +
> +#endif /* DEBUG_TUPLE_ACCESS */
>
>
> /* HeapTupleHeader accessor macros */
>
> +#define HeapTupleHeaderGetOid(tup) \
> +( \
> + AssertHeapTupleHeaderHoffIsValid(tup), \
> + (tup)->t_oid \
> +)
> +
> +#define HeapTupleHeaderSetOid(tup, oid) \
> +( \
> + AssertHeapTupleHeaderHoffIsValid(tup), \
> + (tup)->t_oid = (oid) \
> +)
> +
> +
> #define HeapTupleHeaderGetXmin(tup) \
> ( \
> (tup)->t_xmin \
> @@ -406,4 +437,10 @@
> #define HeapTupleHasExtended(tuple) \
> ((((HeapTuple)(tuple))->t_data->t_infomask & HEAP_HASEXTENDED) != 0)
>
> +#define HeapTupleGetOid(tuple) \
> + HeapTupleHeaderGetOid(((HeapTuple)(tuple))->t_data)
> +
> +#define HeapTupleSetOid(tuple, oid) \
> + HeapTupleHeaderSetOid(((HeapTuple)(tuple))->t_data, (oid))
> +
> #endif /* HTUP_H */
> diff -ru ../base/src/include/pg_config.h.in src/include/pg_config.h.in
> --- ../base/src/include/pg_config.h.in 2002-05-05 02:03:29.000000000 +0200
> +++ src/include/pg_config.h.in 2002-07-04 16:53:52.000000000 +0200
> @@ -311,6 +311,12 @@
> /* #define ACLDEBUG */
> /* #define RTDEBUG */
> /* #define GISTDEBUG */
> +/*
> + * DEBUG_TUPLE_ACCESS enables paranoid assertions during
> + * elimination of oids from the fixed sized part of HeapTupleHeader.
> + * This is expected to be undef'd after v7.3 release at the latest.
> + */
> +#define DEBUG_TUPLE_ACCESS
>
> /*
> * defining unsafe floats will make float4 and float8 ops faster
> diff -ru ../base/src/include/utils/rel.h src/include/utils/rel.h
> --- ../base/src/include/utils/rel.h 2002-06-21 02:12:31.000000000 +0200
> +++ src/include/utils/rel.h 2002-07-04 16:29:59.000000000 +0200
> @@ -258,4 +258,10 @@
> #define RelationGetNamespace(relation) \
> ((relation)->rd_rel->relnamespace)
>
> +/*
> + * AssertRelationHasOids
> + * to be used before ...GetOid() and ...SetOid()
> + */
> +#define AssertRelationHasOids(rel) Assert(rel->rd_rel->relhasoids)
> +
> #endif /* REL_H */
> diff -ru ../base/src/pl/plpython/plpython.c src/pl/plpython/plpython.c
> --- ../base/src/pl/plpython/plpython.c 2002-06-17 10:11:34.000000000 +0200
> +++ src/pl/plpython/plpython.c 2002-07-04 00:26:40.000000000 +0200
> @@ -2091,7 +2091,7 @@
> Py_DECREF(optr);
> optr = NULL; /* this is important */
>
> - plan->types[i] = typeTup->t_data->t_oid;
> + plan->types[i] = HeapTupleGetOid(typeTup);
> typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
> if (typeStruct->typrelid == InvalidOid)
> PLy_output_datum_func(&plan->args[i], typeStruct);
> diff -ru ../base/src/pl/tcl/pltcl.c src/pl/tcl/pltcl.c
> --- ../base/src/pl/tcl/pltcl.c 2002-06-17 10:11:34.000000000 +0200
> +++ src/pl/tcl/pltcl.c 2002-07-04 00:26:40.000000000 +0200
> @@ -1755,7 +1755,7 @@
> {
> /* XXX should extend this to allow qualified type names */
> typeTup = typenameType(makeTypeName(args[i]));
> - qdesc->argtypes[i] = typeTup->t_data->t_oid;
> + qdesc->argtypes[i] = HeapTupleGetOid(typeTup);
> perm_fmgr_info(((Form_pg_type) GETSTRUCT(typeTup))->typinput,
> &(qdesc->arginfuncs[i]));
> qdesc->argtypelems[i] = ((Form_pg_type) GETSTRUCT(typeTup))->typelem;
> diff -ru ../base/contrib/dbsize/dbsize.c contrib/dbsize/dbsize.c
> --- ../base/contrib/dbsize/dbsize.c 2002-05-21 11:54:08.000000000 +0200
> +++ contrib/dbsize/dbsize.c 2002-07-04 00:26:40.000000000 +0200
> @@ -65,7 +65,8 @@
> if (!HeapTupleIsValid(tuple))
> elog(ERROR, "database %s does not exist", NameStr(*dbname));
>
> - dbid = tuple->t_data->t_oid;
> + AssertRelationHasOids(relation);
> + dbid = HeapTupleGetOid(tuple);
> if (dbid == InvalidOid)
> elog(ERROR, "invalid database id");
>
> diff -ru ../base/contrib/fulltextindex/fti.c contrib/fulltextindex/fti.c
> --- ../base/contrib/fulltextindex/fti.c 2001-11-05 19:46:23.000000000 +0100
> +++ contrib/fulltextindex/fti.c 2002-07-04 00:26:40.000000000 +0200
> @@ -190,7 +190,7 @@
> tupdesc = rel->rd_att; /* what the tuple looks like (?) */
>
> /* get oid of current tuple, needed by all, so place here */
> - oid = rettuple->t_data->t_oid;
> + oid = rel->rd_rel->relhasoids ? HeapTupleGetOid(rettuple) : InvalidOid;
> if (!OidIsValid(oid))
> elog(ERROR, "Full Text Indexing: Oid of current tuple is invalid");
>
> diff -ru ../base/contrib/rserv/rserv.c contrib/rserv/rserv.c
> --- ../base/contrib/rserv/rserv.c 2002-03-06 08:09:11.000000000 +0100
> +++ contrib/rserv/rserv.c 2002-07-04 00:26:40.000000000 +0200
> @@ -102,7 +102,9 @@
>
> if (keynum == ObjectIdAttributeNumber)
> {
> - sprintf(oidbuf, "%u", tuple->t_data->t_oid);
> + sprintf(oidbuf, "%u", rel->rd_rel->relhasoids
> + ? HeapTupleGetOid(tuple)
> + : InvalidOid);
> key = oidbuf;
> }
> else
>
> Servus
> Manfred
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
>
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Page | 2002-07-12 07:02:15 | Re: UI patch (Was: ODBC Patch to prevent setting of KSQO on 7.3+ servers) |
Previous Message | Bruce Momjian | 2002-07-12 03:00:36 | Re: Wrap access to Oid II |