aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/common/tupdesc.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-09-02 01:05:06 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-09-02 01:05:06 +0000
commitc7a165adc64e3e67e0dcee4088d84a0638b3515a (patch)
tree97d02a63e6ab6a516cb8e8ba24b0ba42782d202d /src/backend/access/common/tupdesc.c
parentfcd34f9f7ff561213beef97f93c32f415e35a79c (diff)
downloadpostgresql-c7a165adc64e3e67e0dcee4088d84a0638b3515a.tar.gz
postgresql-c7a165adc64e3e67e0dcee4088d84a0638b3515a.zip
Code review for HeapTupleHeader changes. Add version number to page headers
(overlaying low byte of page size) and add HEAP_HASOID bit to t_infomask, per earlier discussion. Simplify scheme for overlaying fields in tuple header (no need for cmax to live in more than one place). Don't try to clear infomask status bits in tqual.c --- not safe to do it there. Don't try to force output table of a SELECT INTO to have OIDs, either. Get rid of unnecessarily complex three-state scheme for TupleDesc.tdhasoids, which has already caused one recent failure. Improve documentation.
Diffstat (limited to 'src/backend/access/common/tupdesc.c')
-rw-r--r--src/backend/access/common/tupdesc.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c
index f90717aa12a..6d6cdf38ce8 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.87 2002/08/30 19:23:18 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.88 2002/09/02 01:05:03 tgl Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -37,7 +37,7 @@
* ----------------------------------------------------------------
*/
TupleDesc
-CreateTemplateTupleDesc(int natts, hasoid_t withoid)
+CreateTemplateTupleDesc(int natts, bool hasoid)
{
uint32 size;
TupleDesc desc;
@@ -59,7 +59,7 @@ CreateTemplateTupleDesc(int natts, hasoid_t withoid)
MemSet(desc->attrs, 0, size);
desc->natts = natts;
- desc->tdhasoid = withoid;
+ desc->tdhasoid = hasoid;
return desc;
}
@@ -67,11 +67,12 @@ CreateTemplateTupleDesc(int natts, hasoid_t withoid)
/* ----------------------------------------------------------------
* CreateTupleDesc
*
- * This function allocates a new TupleDesc from Form_pg_attribute array
+ * This function allocates a new TupleDesc pointing to a given
+ * Form_pg_attribute array
* ----------------------------------------------------------------
*/
TupleDesc
-CreateTupleDesc(int natts, Form_pg_attribute *attrs)
+CreateTupleDesc(int natts, bool hasoid, Form_pg_attribute *attrs)
{
TupleDesc desc;
@@ -84,7 +85,7 @@ CreateTupleDesc(int natts, Form_pg_attribute *attrs)
desc->attrs = attrs;
desc->natts = natts;
desc->constr = NULL;
- desc->tdhasoid = UNDEFOID;
+ desc->tdhasoid = hasoid;
return desc;
}
@@ -129,7 +130,6 @@ CreateTupleDescCopy(TupleDesc tupdesc)
*
* This function creates a new TupleDesc by copying from an existing
* TupleDesc (with Constraints)
- *
* ----------------------------------------------------------------
*/
TupleDesc
@@ -477,6 +477,9 @@ TupleDescInitEntry(TupleDesc desc,
* BuildDescForRelation
*
* Given a relation schema (list of ColumnDef nodes), build a TupleDesc.
+ *
+ * Note: the default assumption is no OIDs; caller may modify the returned
+ * TupleDesc if it wants OIDs.
*/
TupleDesc
BuildDescForRelation(List *schema)
@@ -497,7 +500,7 @@ BuildDescForRelation(List *schema)
* allocate a new tuple descriptor
*/
natts = length(schema);
- desc = CreateTemplateTupleDesc(natts, UNDEFOID);
+ desc = CreateTemplateTupleDesc(natts, false);
constr->has_not_null = false;
attnum = 0;
@@ -667,7 +670,7 @@ TypeGetTupleDesc(Oid typeoid, List *colaliases)
/* OK, get the column alias */
attname = strVal(lfirst(colaliases));
- tupdesc = CreateTemplateTupleDesc(1, WITHOUTOID);
+ tupdesc = CreateTemplateTupleDesc(1, false);
TupleDescInitEntry(tupdesc,
(AttrNumber) 1,
attname,