Skip to content

Commit 4405b3e

Browse files
committed
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.
1 parent 45842e6 commit 4405b3e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/backend/optimizer/util/clauses.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.162 2004/01/12 20:48:15 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.163 2004/01/28 00:05:04 tgl Exp $
1212
*
1313
* HISTORY
1414
* AUTHOR DATE MAJOR EVENT
@@ -1711,6 +1711,7 @@ evaluate_function(Oid funcid, Oid result_type, List *args,
17111711
bool has_null_input = false;
17121712
List *arg;
17131713
FuncExpr *newexpr;
1714+
char result_typtype;
17141715

17151716
/*
17161717
* Can't simplify if it returns a set.
@@ -1747,6 +1748,15 @@ evaluate_function(Oid funcid, Oid result_type, List *args,
17471748
has_nonconst_input)
17481749
return NULL;
17491750

1751+
/*
1752+
* Can't simplify functions returning composite types (mainly because
1753+
* datumCopy() doesn't cope; FIXME someday when we have a saner
1754+
* representation for whole-tuple results).
1755+
*/
1756+
result_typtype = get_typtype(funcform->prorettype);
1757+
if (result_typtype == 'c')
1758+
return NULL;
1759+
17501760
/*
17511761
* OK, looks like we can simplify this operator/function.
17521762
*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy