summaryrefslogtreecommitdiff
path: root/src/backend/optimizer
diff options
context:
space:
mode:
authorTom Lane2004-01-28 00:05:04 +0000
committerTom Lane2004-01-28 00:05:04 +0000
commit4405b3e05e566794fff92767fae7994a3c495d7f (patch)
treeda30e74984803a70cdb04c66c9e267a9e4a5d58b /src/backend/optimizer
parent45842e6c52ec78100529f5523444985d4b8c61dd (diff)
simplify_function() mustn't try to evaluate functions that return
composite types, because TupleTableSlots aren't Datums and can't be stored in Const nodes. We can remove this restriction if we ever adopt a cleaner runtime representation for whole-tuple results, but at the moment it's broken. Per example from Thomas Hallgren.
Diffstat (limited to 'src/backend/optimizer')
-rw-r--r--src/backend/optimizer/util/clauses.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index a5faff26cfd..a767eda803c 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.162 2004/01/12 20:48:15 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.163 2004/01/28 00:05:04 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -1711,6 +1711,7 @@ evaluate_function(Oid funcid, Oid result_type, List *args,
bool has_null_input = false;
List *arg;
FuncExpr *newexpr;
+ char result_typtype;
/*
* Can't simplify if it returns a set.
@@ -1748,6 +1749,15 @@ evaluate_function(Oid funcid, Oid result_type, List *args,
return NULL;
/*
+ * Can't simplify functions returning composite types (mainly because
+ * datumCopy() doesn't cope; FIXME someday when we have a saner
+ * representation for whole-tuple results).
+ */
+ result_typtype = get_typtype(funcform->prorettype);
+ if (result_typtype == 'c')
+ return NULL;
+
+ /*
* OK, looks like we can simplify this operator/function.
*
* Build a new FuncExpr node containing the already-simplified arguments.