summaryrefslogtreecommitdiff
path: root/src/backend/executor/functions.c
diff options
context:
space:
mode:
authorTom Lane2010-12-01 05:53:44 +0000
committerTom Lane2010-12-01 05:53:44 +0000
commit8a6eb2ee9895b88311d01fd0d54fb380304d3df6 (patch)
tree03057a4145787b9f2b563d65215c2ed9363ce365 /src/backend/executor/functions.c
parent35a3def7b218f2264cf34385a8487a36f96e76ec (diff)
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 84398e8a960..f974febeee5 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -949,6 +949,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 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)
{