1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-27 23:21:58 +03:00

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.
This commit is contained in:
Tom Lane
2008-11-30 20:51:25 +00:00
parent 3f936aacc0
commit c1f3073333
14 changed files with 108 additions and 83 deletions

View File

@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.318 2008/11/19 01:10:23 tgl Exp $
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.319 2008/11/30 20:51:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -2833,7 +2833,7 @@ OpenIntoRel(QueryDesc *queryDesc)
/*
* Now replace the query's DestReceiver with one for SELECT INTO
*/
queryDesc->dest = CreateDestReceiver(DestIntoRel, NULL);
queryDesc->dest = CreateDestReceiver(DestIntoRel);
myState = (DR_intorel *) queryDesc->dest;
Assert(myState->pub.mydest == DestIntoRel);
myState->estate = estate;
@ -2877,10 +2877,6 @@ CloseIntoRel(QueryDesc *queryDesc)
/*
* CreateIntoRelDestReceiver -- create a suitable DestReceiver object
*
* Since CreateDestReceiver doesn't accept the parameters we'd need,
* we just leave the private fields zeroed here. OpenIntoRel will
* fill them in.
*/
DestReceiver *
CreateIntoRelDestReceiver(void)
@ -2893,6 +2889,8 @@ CreateIntoRelDestReceiver(void)
self->pub.rDestroy = intorel_destroy;
self->pub.mydest = DestIntoRel;
/* private fields will be set by OpenIntoRel */
return (DestReceiver *) self;
}