aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/functions.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-12-01 00:53:18 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2010-12-01 00:53:18 -0500
commit225f0aa3dfef55554cbe2e6da73df5e41b9eec18 (patch)
treed56a67413567230eeb8166a2666ed22cfe9b4d7e /src/backend/executor/functions.c
parentc0b5fac7010fa3468577d3a90ee8783639500fed (diff)
downloadpostgresql-225f0aa3dfef55554cbe2e6da73df5e41b9eec18.tar.gz
postgresql-225f0aa3dfef55554cbe2e6da73df5e41b9eec18.zip
Prevent inlining a SQL function with multiple OUT parameters.
There were corner cases in which the planner would attempt to inline such a function, which would result in a failure at runtime due to loss of information about exactly what the result record type is. Fix by disabling inlining when the function's recorded result type is RECORD. There might be some sub-cases where inlining could still be allowed, but this is a simple and backpatchable fix, so leave refinements for another day. Per bug #5777 from Nate Carson. Back-patch to all supported branches. 8.1 happens to avoid a core-dump here, but it still does the wrong thing.
Diffstat (limited to 'src/backend/executor/functions.c')
-rw-r--r--src/backend/executor/functions.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 498bcba5816..11f92adbb06 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -1171,6 +1171,11 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList,
* This can happen, for example, where the body of the function is
* 'SELECT func2()', where func2 has the same composite return type as
* the function that's calling it.
+ *
+ * XXX Note that if rettype is RECORD, the IsBinaryCoercible check
+ * will succeed for any composite restype. For the moment we rely on
+ * runtime type checking to catch any discrepancy, but it'd be nice to
+ * do better at parse time.
*/
if (tlistlen == 1)
{