diff options
| author | Bruce Momjian <bruce@momjian.us> | 2002-07-20 05:16:59 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2002-07-20 05:16:59 +0000 |
| commit | b0f5086e4133d1d8ec092799952dda65ebd717c8 (patch) | |
| tree | 0f717342af7cce7896d40fdb34ccc572e435d499 /src/backend/access/common/tupdesc.c | |
| parent | 38dd3ae7d032eecc6ddadcbd402d90f6ac38f6a3 (diff) | |
| download | postgresql-b0f5086e4133d1d8ec092799952dda65ebd717c8.tar.gz | |
oid is needed, it is added at the end of the struct (after the null
bitmap, if present).
Per Tom Lane's suggestion the information whether a tuple has an oid
or not is carried in the tuple descriptor. For debugging reasons
tdhasoid is of type char, not bool. There are predefined values for
WITHOID, WITHOUTOID and UNDEFOID.
This patch has been generated against a cvs snapshot from last week
and I don't expect it to apply cleanly to current sources. While I
post it here for public review, I'm working on a new version against a
current snapshot. (There's been heavy activity recently; hope to
catch up some day ...)
This is a long patch; if it is too hard to swallow, I can provide it
in smaller pieces:
Part 1: Accessor macros
Part 2: tdhasoid in TupDesc
Part 3: Regression test
Part 4: Parameter withoid to heap_addheader
Part 5: Eliminate t_oid from HeapTupleHeader
Part 2 is the most hairy part because of changes in the executor and
even in the parser; the other parts are straightforward.
Up to part 4 the patched postmaster stays binary compatible to
databases created with an unpatched version. Part 5 is small (100
lines) and finally breaks compatibility.
Manfred Koizar
Diffstat (limited to 'src/backend/access/common/tupdesc.c')
| -rw-r--r-- | src/backend/access/common/tupdesc.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c index af73941369..24f33fac4b 100644 --- a/src/backend/access/common/tupdesc.c +++ b/src/backend/access/common/tupdesc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.80 2002/06/20 20:29:24 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.81 2002/07/20 05:16:56 momjian Exp $ * * NOTES * some of the executor utility code such as "ExecTypeFromTL" should be @@ -36,7 +36,7 @@ * ---------------------------------------------------------------- */ TupleDesc -CreateTemplateTupleDesc(int natts) +CreateTemplateTupleDesc(int natts, hasoid_t withoid) { uint32 size; TupleDesc desc; @@ -58,6 +58,7 @@ CreateTemplateTupleDesc(int natts) MemSet(desc->attrs, 0, size); desc->natts = natts; + desc->tdhasoid = withoid; return desc; } @@ -82,6 +83,7 @@ CreateTupleDesc(int natts, Form_pg_attribute *attrs) desc->attrs = attrs; desc->natts = natts; desc->constr = NULL; + desc->tdhasoid = UNDEFOID; return desc; } @@ -116,6 +118,7 @@ CreateTupleDescCopy(TupleDesc tupdesc) desc->attrs[i]->atthasdef = false; } desc->constr = NULL; + desc->tdhasoid = tupdesc->tdhasoid; return desc; } @@ -182,6 +185,7 @@ CreateTupleDescCopyConstr(TupleDesc tupdesc) else desc->constr = NULL; + desc->tdhasoid = tupdesc->tdhasoid; return desc; } @@ -235,6 +239,8 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2) if (tupdesc1->natts != tupdesc2->natts) return false; + if (tupdesc1->tdhasoid != tupdesc2->tdhasoid) + return false; for (i = 0; i < tupdesc1->natts; i++) { Form_pg_attribute attr1 = tupdesc1->attrs[i]; @@ -392,7 +398,7 @@ TupleDescInitEntry(TupleDesc desc, */ 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 @@ -479,7 +485,7 @@ BuildDescForRelation(List *schema) * allocate a new tuple descriptor */ natts = length(schema); - desc = CreateTemplateTupleDesc(natts); + desc = CreateTemplateTupleDesc(natts, UNDEFOID); constr->has_not_null = false; attnum = 0; @@ -646,7 +652,7 @@ TypeGetTupleDesc(Oid typeoid, List *colaliases) /* OK, get the column alias */ attname = strVal(lfirst(colaliases)); - tupdesc = CreateTemplateTupleDesc(1); + tupdesc = CreateTemplateTupleDesc(1, WITHOUTOID); TupleDescInitEntry(tupdesc, (AttrNumber) 1, attname, |
