mirror of
https://github.com/postgres/postgres.git
synced 2025-07-23 03:21:12 +03:00
Reimplement nodeMaterial to use a temporary BufFile (or even memory, if the
materialized tupleset is small enough) instead of a temporary relation. This was something I was thinking of doing anyway for performance, and Jan says he needs it for TOAST because he doesn't want to cope with toasting noname relations. With this change, the 'noname table' support in heap.c is dead code, and I have accordingly removed it. Also clean up 'noname' plan handling in planner --- nonames are either sort or materialize plans, and it seems less confusing to handle them separately under those names.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.113 2000/04/12 17:15:16 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.114 2000/06/18 22:44:05 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -414,41 +414,6 @@ _copyHashJoin(HashJoin *from)
|
||||
}
|
||||
|
||||
|
||||
/* ----------------
|
||||
* CopyNonameFields
|
||||
*
|
||||
* This function copies the fields of the Noname node. It is used by
|
||||
* all the copy functions for classes which inherit from Noname.
|
||||
* ----------------
|
||||
*/
|
||||
static void
|
||||
CopyNonameFields(Noname *from, Noname *newnode)
|
||||
{
|
||||
newnode->nonameid = from->nonameid;
|
||||
newnode->keycount = from->keycount;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* ----------------
|
||||
* _copyNoname
|
||||
* ----------------
|
||||
*/
|
||||
static Noname *
|
||||
_copyNoname(Noname *from)
|
||||
{
|
||||
Noname *newnode = makeNode(Noname);
|
||||
|
||||
/* ----------------
|
||||
* copy node superclass fields
|
||||
* ----------------
|
||||
*/
|
||||
CopyPlanFields((Plan *) from, (Plan *) newnode);
|
||||
CopyNonameFields(from, newnode);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* _copyMaterial
|
||||
* ----------------
|
||||
@ -463,7 +428,6 @@ _copyMaterial(Material *from)
|
||||
* ----------------
|
||||
*/
|
||||
CopyPlanFields((Plan *) from, (Plan *) newnode);
|
||||
CopyNonameFields((Noname *) from, (Noname *) newnode);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
@ -483,7 +447,8 @@ _copySort(Sort *from)
|
||||
* ----------------
|
||||
*/
|
||||
CopyPlanFields((Plan *) from, (Plan *) newnode);
|
||||
CopyNonameFields((Noname *) from, (Noname *) newnode);
|
||||
|
||||
newnode->keycount = from->keycount;
|
||||
|
||||
return newnode;
|
||||
}
|
||||
@ -552,7 +517,6 @@ _copyUnique(Unique *from)
|
||||
* ----------------
|
||||
*/
|
||||
CopyPlanFields((Plan *) from, (Plan *) newnode);
|
||||
CopyNonameFields((Noname *) from, (Noname *) newnode);
|
||||
|
||||
/* ----------------
|
||||
* copy remainder of node
|
||||
@ -1695,9 +1659,6 @@ copyObject(void *from)
|
||||
case T_HashJoin:
|
||||
retval = _copyHashJoin(from);
|
||||
break;
|
||||
case T_Noname:
|
||||
retval = _copyNoname(from);
|
||||
break;
|
||||
case T_Material:
|
||||
retval = _copyMaterial(from);
|
||||
break;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.41 2000/05/28 17:55:57 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.42 2000/06/18 22:44:05 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -305,37 +305,6 @@ _freeHashJoin(HashJoin *node)
|
||||
}
|
||||
|
||||
|
||||
/* ----------------
|
||||
* FreeNonameFields
|
||||
*
|
||||
* This function frees the fields of the Noname node. It is used by
|
||||
* all the free functions for classes which inherit node Noname.
|
||||
* ----------------
|
||||
*/
|
||||
static void
|
||||
FreeNonameFields(Noname *node)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* ----------------
|
||||
* _freeNoname
|
||||
* ----------------
|
||||
*/
|
||||
static void
|
||||
_freeNoname(Noname *node)
|
||||
{
|
||||
/* ----------------
|
||||
* free node superclass fields
|
||||
* ----------------
|
||||
*/
|
||||
FreePlanFields((Plan *) node);
|
||||
FreeNonameFields(node);
|
||||
|
||||
pfree(node);
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* _freeMaterial
|
||||
* ----------------
|
||||
@ -348,7 +317,6 @@ _freeMaterial(Material *node)
|
||||
* ----------------
|
||||
*/
|
||||
FreePlanFields((Plan *) node);
|
||||
FreeNonameFields((Noname *) node);
|
||||
|
||||
pfree(node);
|
||||
}
|
||||
@ -366,7 +334,6 @@ _freeSort(Sort *node)
|
||||
* ----------------
|
||||
*/
|
||||
FreePlanFields((Plan *) node);
|
||||
FreeNonameFields((Noname *) node);
|
||||
|
||||
pfree(node);
|
||||
}
|
||||
@ -421,7 +388,6 @@ _freeUnique(Unique *node)
|
||||
* ----------------
|
||||
*/
|
||||
FreePlanFields((Plan *) node);
|
||||
FreeNonameFields((Noname *) node);
|
||||
|
||||
/* ----------------
|
||||
* free remainder of node
|
||||
@ -1194,9 +1160,6 @@ freeObject(void *node)
|
||||
case T_HashJoin:
|
||||
_freeHashJoin(node);
|
||||
break;
|
||||
case T_Noname:
|
||||
_freeNoname(node);
|
||||
break;
|
||||
case T_Material:
|
||||
_freeMaterial(node);
|
||||
break;
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.119 2000/06/16 05:27:02 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.120 2000/06/18 22:44:05 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Every (plan) node in POSTGRES has an associated "out" routine which
|
||||
@ -531,51 +531,29 @@ _outTidScan(StringInfo str, TidScan *node)
|
||||
}
|
||||
|
||||
/*
|
||||
* Noname is a subclass of Plan
|
||||
*/
|
||||
static void
|
||||
_outNoname(StringInfo str, Noname *node)
|
||||
{
|
||||
appendStringInfo(str, " NONAME ");
|
||||
_outPlanInfo(str, (Plan *) node);
|
||||
|
||||
appendStringInfo(str, " :nonameid %u :keycount %d ",
|
||||
node->nonameid,
|
||||
node->keycount);
|
||||
}
|
||||
|
||||
/*
|
||||
* Material is a subclass of Noname
|
||||
* Material is a subclass of Plan
|
||||
*/
|
||||
static void
|
||||
_outMaterial(StringInfo str, Material *node)
|
||||
{
|
||||
appendStringInfo(str, " MATERIAL ");
|
||||
_outPlanInfo(str, (Plan *) node);
|
||||
|
||||
appendStringInfo(str, " :nonameid %u :keycount %d ",
|
||||
node->nonameid,
|
||||
node->keycount);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sort is a subclass of Noname
|
||||
* Sort is a subclass of Plan
|
||||
*/
|
||||
static void
|
||||
_outSort(StringInfo str, Sort *node)
|
||||
{
|
||||
appendStringInfo(str, " SORT ");
|
||||
_outPlanInfo(str, (Plan *) node);
|
||||
|
||||
appendStringInfo(str, " :nonameid %u :keycount %d ",
|
||||
node->nonameid,
|
||||
node->keycount);
|
||||
appendStringInfo(str, " :keycount %d ", node->keycount);
|
||||
}
|
||||
|
||||
static void
|
||||
_outAgg(StringInfo str, Agg *node)
|
||||
{
|
||||
|
||||
appendStringInfo(str, " AGG ");
|
||||
_outPlanInfo(str, (Plan *) node);
|
||||
}
|
||||
@ -592,9 +570,6 @@ _outGroup(StringInfo str, Group *node)
|
||||
node->tuplePerGroup ? "true" : "false");
|
||||
}
|
||||
|
||||
/*
|
||||
* For some reason, unique is a subclass of Noname.
|
||||
*/
|
||||
static void
|
||||
_outUnique(StringInfo str, Unique *node)
|
||||
{
|
||||
@ -603,17 +578,14 @@ _outUnique(StringInfo str, Unique *node)
|
||||
appendStringInfo(str, " UNIQUE ");
|
||||
_outPlanInfo(str, (Plan *) node);
|
||||
|
||||
appendStringInfo(str, " :nonameid %u :keycount %d :numCols %d :uniqColIdx ",
|
||||
node->nonameid,
|
||||
node->keycount,
|
||||
appendStringInfo(str, " :numCols %d :uniqColIdx ",
|
||||
node->numCols);
|
||||
|
||||
for (i = 0; i < node->numCols; i++)
|
||||
appendStringInfo(str, "%d ", (int) node->uniqColIdx[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Hash is a subclass of Noname
|
||||
* Hash is a subclass of Plan
|
||||
*/
|
||||
static void
|
||||
_outHash(StringInfo str, Hash *node)
|
||||
@ -1502,9 +1474,6 @@ _outNode(StringInfo str, void *obj)
|
||||
case T_TidScan:
|
||||
_outTidScan(str, obj);
|
||||
break;
|
||||
case T_Noname:
|
||||
_outNoname(str, obj);
|
||||
break;
|
||||
case T_Material:
|
||||
_outMaterial(str, obj);
|
||||
break;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.38 2000/04/12 17:15:16 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.39 2000/06/18 22:44:05 tgl Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@ -315,9 +315,6 @@ plannode_type(Plan *p)
|
||||
case T_HashJoin:
|
||||
return "HASHJOIN";
|
||||
break;
|
||||
case T_Noname:
|
||||
return "NONAME";
|
||||
break;
|
||||
case T_Material:
|
||||
return "MATERIAL";
|
||||
break;
|
||||
@ -333,9 +330,6 @@ plannode_type(Plan *p)
|
||||
case T_Hash:
|
||||
return "HASH";
|
||||
break;
|
||||
case T_Choose:
|
||||
return "CHOOSE";
|
||||
break;
|
||||
case T_Group:
|
||||
return "GROUP";
|
||||
break;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.90 2000/06/16 05:27:03 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.91 2000/06/18 22:44:05 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Most of the read functions for plan nodes are tested. (In fact, they
|
||||
@ -555,38 +555,10 @@ _readTidScan()
|
||||
return local_node;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* _readNoname
|
||||
*
|
||||
* Noname is a subclass of Plan
|
||||
* ----------------
|
||||
*/
|
||||
static Noname *
|
||||
_readNoname()
|
||||
{
|
||||
Noname *local_node;
|
||||
char *token;
|
||||
int length;
|
||||
|
||||
local_node = makeNode(Noname);
|
||||
|
||||
_getPlan((Plan *) local_node);
|
||||
|
||||
token = lsptok(NULL, &length); /* eat :nonameid */
|
||||
token = lsptok(NULL, &length); /* get nonameid */
|
||||
local_node->nonameid = atol(token);
|
||||
|
||||
token = lsptok(NULL, &length); /* eat :keycount */
|
||||
token = lsptok(NULL, &length); /* get keycount */
|
||||
local_node->keycount = atoi(token);
|
||||
|
||||
return local_node;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* _readSort
|
||||
*
|
||||
* Sort is a subclass of Noname
|
||||
* Sort is a subclass of Plan
|
||||
* ----------------
|
||||
*/
|
||||
static Sort *
|
||||
@ -600,10 +572,6 @@ _readSort()
|
||||
|
||||
_getPlan((Plan *) local_node);
|
||||
|
||||
token = lsptok(NULL, &length); /* eat :nonameid */
|
||||
token = lsptok(NULL, &length); /* get nonameid */
|
||||
local_node->nonameid = atol(token);
|
||||
|
||||
token = lsptok(NULL, &length); /* eat :keycount */
|
||||
token = lsptok(NULL, &length); /* get keycount */
|
||||
local_node->keycount = atoi(token);
|
||||
@ -625,7 +593,7 @@ _readAgg()
|
||||
/* ----------------
|
||||
* _readHash
|
||||
*
|
||||
* Hash is a subclass of Noname
|
||||
* Hash is a subclass of Plan
|
||||
* ----------------
|
||||
*/
|
||||
static Hash *
|
||||
@ -1853,8 +1821,6 @@ parsePlanString(void)
|
||||
return_value = _readIndexScan();
|
||||
else if (length == 7 && strncmp(token, "TIDSCAN", length) == 0)
|
||||
return_value = _readTidScan();
|
||||
else if (length == 6 && strncmp(token, "NONAME", length) == 0)
|
||||
return_value = _readNoname();
|
||||
else if (length == 4 && strncmp(token, "SORT", length) == 0)
|
||||
return_value = _readSort();
|
||||
else if (length == 6 && strncmp(token, "AGGREG", length) == 0)
|
||||
|
Reference in New Issue
Block a user