1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

Implement feature of new FE/BE protocol whereby RowDescription identifies

the column by table OID and column number, if it's a simple column
reference.  Along the way, get rid of reskey/reskeyop fields in Resdoms.
Turns out that representation was not convenient for either the planner
or the executor; we can make the planner deliver exactly what the
executor wants with no more effort.
initdb forced due to change in stored rule representation.
This commit is contained in:
Tom Lane
2003-05-06 00:20:33 +00:00
parent 94a3c60324
commit 2cf57c8f8d
32 changed files with 454 additions and 336 deletions

View File

@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.249 2003/05/02 20:54:34 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.250 2003/05/06 00:20:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -448,7 +448,9 @@ _copySort(Sort *from)
*/
CopyPlanFields((Plan *) from, (Plan *) newnode);
COPY_SCALAR_FIELD(keycount);
COPY_SCALAR_FIELD(numCols);
COPY_POINTER_FIELD(sortColIdx, from->numCols * sizeof(AttrNumber));
COPY_POINTER_FIELD(sortOperators, from->numCols * sizeof(Oid));
return newnode;
}
@@ -596,8 +598,8 @@ _copyResdom(Resdom *from)
COPY_SCALAR_FIELD(restypmod);
COPY_STRING_FIELD(resname);
COPY_SCALAR_FIELD(ressortgroupref);
COPY_SCALAR_FIELD(reskey);
COPY_SCALAR_FIELD(reskeyop);
COPY_SCALAR_FIELD(resorigtbl);
COPY_SCALAR_FIELD(resorigcol);
COPY_SCALAR_FIELD(resjunk);
return newnode;

View File

@@ -18,7 +18,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.192 2003/05/02 20:54:34 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.193 2003/05/06 00:20:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -104,8 +104,8 @@ _equalResdom(Resdom *a, Resdom *b)
COMPARE_SCALAR_FIELD(restypmod);
COMPARE_STRING_FIELD(resname);
COMPARE_SCALAR_FIELD(ressortgroupref);
COMPARE_SCALAR_FIELD(reskey);
COMPARE_SCALAR_FIELD(reskeyop);
COMPARE_SCALAR_FIELD(resorigtbl);
COMPARE_SCALAR_FIELD(resorigcol);
COMPARE_SCALAR_FIELD(resjunk);
return true;

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.38 2003/02/10 04:44:45 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.39 2003/05/06 00:20:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -117,16 +117,16 @@ makeResdom(AttrNumber resno,
resdom->resname = resname;
/*
* We always set the sorting/grouping fields to 0. If the caller
* wants to change them he must do so explicitly. Few if any callers
* should be doing that, so omitting these arguments reduces the
* chance of error.
* We always set these fields to 0. If the caller wants to change them
* he must do so explicitly. Few callers do that, so omitting these
* arguments reduces the chance of error.
*/
resdom->ressortgroupref = 0;
resdom->reskey = 0;
resdom->reskeyop = InvalidOid;
resdom->resorigtbl = InvalidOid;
resdom->resorigcol = 0;
resdom->resjunk = resjunk;
return resdom;
}

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.204 2003/05/02 20:54:34 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.205 2003/05/06 00:20:32 tgl Exp $
*
* NOTES
* Every node type that can appear in stored rules' parsetrees *must*
@@ -420,11 +420,17 @@ _outAgg(StringInfo str, Agg *node)
static void
_outGroup(StringInfo str, Group *node)
{
WRITE_NODE_TYPE("GRP");
int i;
WRITE_NODE_TYPE("GROUP");
_outPlanInfo(str, (Plan *) node);
WRITE_INT_FIELD(numCols);
appendStringInfo(str, " :grpColIdx");
for (i = 0; i < node->numCols; i++)
appendStringInfo(str, " %d", node->grpColIdx[i]);
}
static void
@@ -438,11 +444,21 @@ _outMaterial(StringInfo str, Material *node)
static void
_outSort(StringInfo str, Sort *node)
{
int i;
WRITE_NODE_TYPE("SORT");
_outPlanInfo(str, (Plan *) node);
WRITE_INT_FIELD(keycount);
WRITE_INT_FIELD(numCols);
appendStringInfo(str, " :sortColIdx");
for (i = 0; i < node->numCols; i++)
appendStringInfo(str, " %d", node->sortColIdx[i]);
appendStringInfo(str, " :sortOperators");
for (i = 0; i < node->numCols; i++)
appendStringInfo(str, " %u", node->sortOperators[i]);
}
static void
@@ -517,8 +533,8 @@ _outResdom(StringInfo str, Resdom *node)
WRITE_INT_FIELD(restypmod);
WRITE_STRING_FIELD(resname);
WRITE_UINT_FIELD(ressortgroupref);
WRITE_UINT_FIELD(reskey);
WRITE_OID_FIELD(reskeyop);
WRITE_OID_FIELD(resorigtbl);
WRITE_INT_FIELD(resorigcol);
WRITE_BOOL_FIELD(resjunk);
}

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.60 2003/01/22 19:26:35 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.61 2003/05/06 00:20:32 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -447,8 +447,8 @@ print_tl(List *tlist, List *rtable)
TargetEntry *tle = lfirst(tl);
printf("\t%d %s\t", tle->resdom->resno, tle->resdom->resname);
if (tle->resdom->reskey != 0)
printf("(%d):\t", tle->resdom->reskey);
if (tle->resdom->ressortgroupref != 0)
printf("(%u):\t", tle->resdom->ressortgroupref);
else
printf(" :\t");
print_expr((Node *) tle->expr, rtable);

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.152 2003/05/02 20:54:34 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.153 2003/05/06 00:20:32 tgl Exp $
*
* NOTES
* Path and Plan nodes do not have any readfuncs support, because we
@@ -310,8 +310,8 @@ _readResdom(void)
READ_INT_FIELD(restypmod);
READ_STRING_FIELD(resname);
READ_UINT_FIELD(ressortgroupref);
READ_UINT_FIELD(reskey);
READ_OID_FIELD(reskeyop);
READ_OID_FIELD(resorigtbl);
READ_INT_FIELD(resorigcol);
READ_BOOL_FIELD(resjunk);
READ_DONE();