diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-04-06 16:34:07 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-04-06 16:34:07 +0000 |
commit | ad161bcc8a3792d18ef2f3ebe66bb1e22d42b6f2 (patch) | |
tree | 18ec8963fbd1d6dd62ad214bfe3552fc2e7d06eb /src/backend/optimizer/plan/planner.c | |
parent | 0f3748a28c42d09d794ff00af3f1f992eaa5fd7c (diff) |
Merge Resdom nodes into TargetEntry nodes to simplify code and save a
few palloc's. I also chose to eliminate the restype and restypmod fields
entirely, since they are redundant with information stored in the node's
contained expression; re-examining the expression at need seems simpler
and more reliable than trying to keep restype/restypmod up to date.
initdb forced due to change in contents of stored rules.
Diffstat (limited to 'src/backend/optimizer/plan/planner.c')
-rw-r--r-- | src/backend/optimizer/plan/planner.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index 5f3c7510cdd..9f898997f00 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.181 2005/03/28 00:58:23 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.182 2005/04/06 16:34:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1349,7 +1349,7 @@ hash_safe_grouping(Query *parse) Operator optup; bool oprcanhash; - optup = equality_oper(tle->resdom->restype, true); + optup = equality_oper(exprType((Node *) tle->expr), true); if (!optup) return false; oprcanhash = ((Form_pg_operator) GETSTRUCT(optup))->oprcanhash; @@ -1467,18 +1467,16 @@ make_subplanTargetList(Query *parse, } if (!sl) { - te = makeTargetEntry(makeResdom(list_length(sub_tlist) + 1, - exprType(groupexpr), - exprTypmod(groupexpr), - NULL, - false), - (Expr *) groupexpr); + te = makeTargetEntry((Expr *) groupexpr, + list_length(sub_tlist) + 1, + NULL, + false); sub_tlist = lappend(sub_tlist, te); *need_tlist_eval = true; /* it's not flat anymore */ } /* and save its resno */ - grpColIdx[keyno++] = te->resdom->resno; + grpColIdx[keyno++] = te->resno; } } @@ -1528,7 +1526,7 @@ locate_grouping_columns(Query *parse, if (!sl) elog(ERROR, "failed to locate grouping columns"); - groupColIdx[keyno++] = te->resdom->resno; + groupColIdx[keyno++] = te->resno; } } @@ -1554,17 +1552,16 @@ postprocess_setop_tlist(List *new_tlist, List *orig_tlist) TargetEntry *orig_tle; /* ignore resjunk columns in setop result */ - if (new_tle->resdom->resjunk) + if (new_tle->resjunk) continue; Assert(orig_tlist_item != NULL); orig_tle = (TargetEntry *) lfirst(orig_tlist_item); orig_tlist_item = lnext(orig_tlist_item); - if (orig_tle->resdom->resjunk) /* should not happen */ + if (orig_tle->resjunk) /* should not happen */ elog(ERROR, "resjunk output columns are not implemented"); - Assert(new_tle->resdom->resno == orig_tle->resdom->resno); - Assert(new_tle->resdom->restype == orig_tle->resdom->restype); - new_tle->resdom->ressortgroupref = orig_tle->resdom->ressortgroupref; + Assert(new_tle->resno == orig_tle->resno); + new_tle->ressortgroupref = orig_tle->ressortgroupref; } if (orig_tlist_item != NULL) elog(ERROR, "resjunk output columns are not implemented"); |