aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-04-14 21:44:09 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-04-14 21:44:09 +0000
commit939712ee73815d9c86ad05d49eb8bf08c49fb7ea (patch)
tree8748b2506a1af98fe0cec228123693e09377dab7
parentb79a718fac17da9a2c71008158a9a650176b6fd9 (diff)
downloadpostgresql-939712ee73815d9c86ad05d49eb8bf08c49fb7ea.tar.gz
postgresql-939712ee73815d9c86ad05d49eb8bf08c49fb7ea.zip
Don't try to constant-fold functions returning RECORD, since the optimizer
isn't presently set up to pass them an expected tuple descriptor. Bug has been there since 7.3 but was just recently reported by Thomas Hallgren.
-rw-r--r--src/backend/optimizer/util/clauses.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index 926162d469c..c5288657528 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.194 2005/04/10 20:57:32 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.195 2005/04/14 21:44:09 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -19,6 +19,7 @@
#include "postgres.h"
+#include "access/heapam.h"
#include "catalog/pg_aggregate.h"
#include "catalog/pg_language.h"
#include "catalog/pg_operator.h"
@@ -2104,6 +2105,16 @@ evaluate_function(Oid funcid, Oid result_type, List *args,
return NULL;
/*
+ * Can't simplify if it returns RECORD, except in the case where it has
+ * OUT parameters, since it will be needing an expected tupdesc which we
+ * can't supply here.
+ */
+ if (funcform->prorettype == RECORDOID &&
+ (heap_attisnull(func_tuple, Anum_pg_proc_proallargtypes) ||
+ heap_attisnull(func_tuple, Anum_pg_proc_proargmodes)))
+ return NULL;
+
+ /*
* Check for constant inputs and especially constant-NULL inputs.
*/
foreach(arg, args)