From c1f3073333d01987ac9c3e5f6c197b9e2afc3ba9 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 30 Nov 2008 20:51:25 +0000 Subject: Clean up the API for DestReceiver objects by eliminating the assumption that a Portal is a useful and sufficient additional argument for CreateDestReceiver --- it just isn't, in most cases. Instead formalize the approach of passing any needed parameters to the receiver separately. One unexpected benefit of this change is that we can declare typedef Portal in a less surprising location. This patch is just code rearrangement and doesn't change any functionality. I'll tackle the HOLD-cursor-vs-toast problem in a follow-on patch. --- src/backend/executor/functions.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/backend/executor/functions.c') diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c index 988f704ad7..b0373da025 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.129 2008/11/27 00:10:04 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.130 2008/11/30 20:51:25 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -398,7 +398,7 @@ postquel_start(execution_state *es, SQLFunctionCachePtr fcache) { DR_sqlfunction *myState; - dest = CreateDestReceiver(DestSQLFunction, NULL); + dest = CreateDestReceiver(DestSQLFunction); /* pass down the needed info to the dest receiver routines */ myState = (DR_sqlfunction *) dest; Assert(myState->pub.mydest == DestSQLFunction); @@ -1269,10 +1269,6 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, /* * CreateSQLFunctionDestReceiver -- create a suitable DestReceiver object - * - * Since CreateDestReceiver doesn't accept the parameters we'd need, - * we just leave the private fields zeroed here. postquel_start will - * fill them in. */ DestReceiver * CreateSQLFunctionDestReceiver(void) @@ -1285,6 +1281,8 @@ CreateSQLFunctionDestReceiver(void) self->pub.rDestroy = sqlfunction_destroy; self->pub.mydest = DestSQLFunction; + /* private fields will be set by postquel_start */ + return (DestReceiver *) self; } -- cgit v1.2.1