aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-12-27 23:59:14 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-12-27 23:59:14 +0000
commit8609d4abf248f0eede4ed9505226da3f7e3e7c84 (patch)
tree39e5a813099835056d76dd385478069d01a8dcbf /src/backend/executor
parent97799fc4757fd2699e0238254875994253659582 (diff)
downloadpostgresql-8609d4abf248f0eede4ed9505226da3f7e3e7c84.tar.gz
postgresql-8609d4abf248f0eede4ed9505226da3f7e3e7c84.zip
Fix portability problems recently exposed by regression tests on Alphas.
1. Distinguish cases where a Datum representing a tuple datatype is an OID from cases where it is a pointer to TupleTableSlot, and make sure we use the right typlen in each case. 2. Make fetchatt() and related code support 8-byte by-value datatypes on machines where Datum is 8 bytes. Centralize knowledge of the available by-value datatype sizes in two macros in tupmacs.h, so that this will be easier if we ever have to do it again.
Diffstat (limited to 'src/backend/executor')
-rw-r--r--src/backend/executor/execTuples.c46
-rw-r--r--src/backend/executor/execUtils.c14
2 files changed, 22 insertions, 38 deletions
diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c
index 65eef4141f4..e27e91071f3 100644
--- a/src/backend/executor/execTuples.c
+++ b/src/backend/executor/execTuples.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.43 2000/11/12 00:36:57 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.44 2000/12/27 23:59:11 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -835,7 +835,7 @@ ExecGetTupType(Plan *node)
return tupType;
}
-/*
+#ifdef NOT_USED
TupleDesc
ExecCopyTupType(TupleDesc td, int natts)
{
@@ -852,30 +852,23 @@ ExecCopyTupType(TupleDesc td, int natts)
}
return newTd;
}
-*/
+#endif
/* ----------------------------------------------------------------
* ExecTypeFromTL
*
+ * Generate a tuple descriptor for the result tuple of a targetlist.
+ * Note that resjunk columns, if any, are included in the result.
+ *
* Currently there are about 4 different places where we create
* TupleDescriptors. They should all be merged, or perhaps
* be rewritten to call BuildDesc().
- *
- * old comments
- * Forms attribute type info from the target list in the node.
- * It assumes all domains are individually specified in the target list.
- * It fails if the target list contains something like Emp.all
- * which represents all the attributes from EMP relation.
- *
- * Conditions:
- * The inner and outer subtrees should be initialized because it
- * might be necessary to know the type infos of the subtrees.
* ----------------------------------------------------------------
*/
TupleDesc
ExecTypeFromTL(List *targetList)
{
- List *tlcdr;
+ List *tlitem;
TupleDesc typeInfo;
Resdom *resdom;
Oid restype;
@@ -897,14 +890,12 @@ ExecTypeFromTL(List *targetList)
typeInfo = CreateTemplateTupleDesc(len);
/* ----------------
- * notes: get resdom from (resdom expr)
- * get_typbyval comes from src/lib/l-lisp/lsyscache.c
+ * scan list, generate type info for each entry
* ----------------
*/
- tlcdr = targetList;
- while (tlcdr != NIL)
+ foreach(tlitem, targetList)
{
- TargetEntry *tle = lfirst(tlcdr);
+ TargetEntry *tle = lfirst(tlitem);
if (tle->resdom != NULL)
{
@@ -920,7 +911,7 @@ ExecTypeFromTL(List *targetList)
0,
false);
-/*
+#ifdef NOT_USED
ExecSetTypeInfo(resdom->resno - 1,
typeInfo,
(Oid) restype,
@@ -929,13 +920,14 @@ ExecTypeFromTL(List *targetList)
NameStr(*resdom->resname),
get_typbyval(restype),
get_typalign(restype));
-*/
+#endif
}
else
{
+ /* XXX this branch looks fairly broken ... tgl 12/2000 */
Resdom *fjRes;
List *fjTlistP;
- List *fjList = lfirst(tlcdr);
+ List *fjList = lfirst(tlitem);
#ifdef SETS_FIXED
TargetEntry *tle;
@@ -953,7 +945,7 @@ ExecTypeFromTL(List *targetList)
fjRes->restypmod,
0,
false);
-/*
+#ifdef NOT_USED
ExecSetTypeInfo(fjRes->resno - 1,
typeInfo,
(Oid) restype,
@@ -962,7 +954,7 @@ ExecTypeFromTL(List *targetList)
(char *) fjRes->resname,
get_typbyval(restype),
get_typalign(restype));
-*/
+#endif
foreach(fjTlistP, lnext(fjList))
{
@@ -978,7 +970,7 @@ ExecTypeFromTL(List *targetList)
0,
false);
-/*
+#ifdef NOT_USED
ExecSetTypeInfo(fjRes->resno - 1,
typeInfo,
(Oid) fjRes->restype,
@@ -987,11 +979,9 @@ ExecTypeFromTL(List *targetList)
(char *) fjRes->resname,
get_typbyval(fjRes->restype),
get_typalign(fjRes->restype));
-*/
+#endif
}
}
-
- tlcdr = lnext(tlcdr);
}
return typeInfo;
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index 3b05a78e83a..5d4d7f145b3 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.69 2000/11/16 22:30:20 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.70 2000/12/27 23:59:11 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -274,16 +274,10 @@ ExecAssignResultTypeFromTL(Plan *node, CommonState *commonstate)
{
List *targetList;
TupleDesc tupDesc;
- int len;
targetList = node->targetlist;
tupDesc = ExecTypeFromTL(targetList);
- len = ExecTargetListLength(targetList);
-
- if (len > 0)
- ExecAssignResultType(commonstate, tupDesc);
- else
- ExecAssignResultType(commonstate, (TupleDesc) NULL);
+ ExecAssignResultType(commonstate, tupDesc);
}
/* ----------------
@@ -582,8 +576,8 @@ ExecSetTypeInfo(int index,
}
/* ----------------
- * ExecFreeTypeInfo frees the array of attrbutes
- * created by ExecMakeTypeInfo and returned by ExecTypeFromTL...
+ * ExecFreeTypeInfo frees the array of attributes
+ * created by ExecMakeTypeInfo and returned by ExecTypeFromTL
* ----------------
*/
void