aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execUtils.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/executor/execUtils.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/executor/execUtils.c')
-rw-r--r--src/backend/executor/execUtils.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index 24f232469b0..3e8cf203b11 100644
--- a/src/backend/executor/execUtils.c
+++ b/src/backend/executor/execUtils.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.88 2002/08/06 02:36:34 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.89 2002/09/02 01:05:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -291,22 +291,36 @@ void
ExecAssignResultTypeFromTL(Plan *node, CommonState *commonstate)
{
ResultRelInfo *ri;
- Relation rel;
- hasoid_t withoid;
+ bool hasoid = false;
TupleDesc tupDesc;
+ /*
+ * This is pretty grotty: we need to ensure that result tuples have
+ * space for an OID iff they are going to be stored into a relation
+ * that has OIDs. We assume that estate->es_result_relation_info
+ * is already set up to describe the target relation. One reason
+ * this is ugly is that all plan nodes in the plan tree will emit
+ * tuples with space for an OID, though we really only need the topmost
+ * plan to do so.
+ *
+ * It would be better to have InitPlan adjust the topmost plan node's
+ * output descriptor after plan tree initialization. However, that
+ * doesn't quite work because in an UPDATE that spans an inheritance
+ * tree, some of the target relations may have OIDs and some not.
+ * We have to make the decision on a per-relation basis as we initialize
+ * each of the child plans of the topmost Append plan. So, this is ugly
+ * but it works, for now ...
+ */
ri = node->state->es_result_relation_info;
if (ri != NULL)
- rel = ri->ri_RelationDesc;
- else
- rel = node->state->es_into_relation_descriptor;
+ {
+ Relation rel = ri->ri_RelationDesc;
- if (rel != NULL)
- withoid = BoolToHasOid(rel->rd_rel->relhasoids);
- else
- withoid = WITHOUTOID;
+ if (rel != NULL)
+ hasoid = rel->rd_rel->relhasoids;
+ }
- tupDesc = ExecTypeFromTL(node->targetlist, withoid);
+ tupDesc = ExecTypeFromTL(node->targetlist, hasoid);
ExecAssignResultType(commonstate, tupDesc, true);
}